473,320 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

need help with a render a cell

andrea8288
please, i need to change only one cell, but i only get change all the column of the table... i am beginner, and im learning english, je je je sorry
Mar 20 '07 #1
6 1557
sicarie
4,677 Expert Mod 4TB
please, i need to change only one cell, but i only get change all the column of the table...
Could you be a bit more specific - what are you working with, is this a database, an excel sheet? If so, what kind? What is the statement you are using to try to change the cell?
Mar 20 '07 #2
Could you be a bit more specific - what are you working with, is this a database, an excel sheet? If so, what kind? What is the statement you are using to try to change the cell?
i am using a render that extends from a tablecellrenderer and i create the jtable and set the table cell renderer, im not using a database, and i need change the cell to a combo or a checkbox, but this change all the column... :-(

look at this

/**
*
* @author adelacruz
*/
public class Renderer extends JComboBox implements TableCellRenderer{

private String type;
/**
* Creates a new instance of Renderer
*/
public Renderer(String type) {
super();
if (type == null)
return;
if (type.equals("attribute")){
addItem("String"); addItem("Long"); addItem("Integer"); addItem("Short");
addItem("Byte"); addItem("Character"); addItem("Double"); addItem("Float");
} else if (type.equals("validation")){
addItem("TXT_UPPR"); addItem("INTEGER"); addItem("DATE"); addItem("NUMERIC"); addItem("NUMERIC_TEL");
} else if (type.equals("widget")){
addItem("textfield"); addItem("checkbox"); addItem("combobox"); addItem("optionbutton");
} else if (type.equals("db")){
addItem("VARCHAR"); addItem("CHAR"); addItem("BOOL"); addItem("BIGINT"); addItem("INT");
addItem("MEDIUMINT"); addItem("DOUBLE"); addItem("DECIMAL"); addItem("FLOAT"); addItem("BLOB");
} else if (type.equals("relClass")){
addItem("*"); addItem("1..*"); addItem("1..1"); addItem("*..1");
}
this.type = type;
}

public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {

if (type.equals("attribute") || type.equals("validation") || type.equals("widget")
|| type.equals("db") || type.equals("relClass")){
setSelectedItem(value);
return this;
}else if(value.equals("true") || value.equals("false")){
JCheckBox check = new JCheckBox();
check.setSelected((value.equals("true")?Boolean.TR UE:Boolean.FALSE));
return check;
}
return new JTextField(value.toString());
}

}

each node have a type, and depends for the type the combo im gonna display...
Mar 20 '07 #3
well, i got it, dont worry... i get render only one cell. thanks a lot at sicarie ;-)
Mar 21 '07 #4
sicarie
4,677 Expert Mod 4TB
well, i got it, dont worry... i get render only one cell. thanks a lot at sicarie ;-)
Awesome! Sorry I couldn't help. May I ask how you did it?
Mar 21 '07 #5
no problem, i know you are too busy, not is only me who need help
well, it was so easy, that i feel like a fool... i did a renderer class and an editor class, i too did a class tableproperties and there i overwrite getCellRenderer and getCellEditor ;-)
Mar 21 '07 #6
jejeje... but if you feel too bad, you still can help me, jejeje, because now the problem is that i cant set the value of the cell ;-D
Mar 21 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Billy Jacobs | last post by:
I am using the Day Render Event to place a red * on each day where there is at least one event. This works fine on my local machine. It however does not work on the production server. The...
16
by: Terry | last post by:
Hi, This is a newbie's question. I want to preload 4 images and only when all 4 images has been loaded into browser's cache, I want to start a slideshow() function. If images are not completed...
7
by: John A. | last post by:
Hello all! I've got a big bunch of pages using tables for layout. Eventually I'll get them set up with more modernized code, but in the meantime I'd like to slip in a little quick holiday...
0
by: jb_in_marietta | last post by:
All, I have written a very simple custom composite control that includes a control of type System.Web.UI.WebControls.Table. The control renders fine in run time, but for some reason, it does...
2
by: Sky Sigal | last post by:
Hello: I'm currently messing around, and need as much feedback/help as I can get, trying to find the most economical/graceful way to build usercontrols that rely on styling to look any good... ...
1
by: desi.american | last post by:
I have a dynamically generates ASPX page with tables and data. Depending on user selection, the same page can be viewed as a simple web page (rendered in HTML) or as an excel spreadsheet. If the...
4
by: Claudio Calboni | last post by:
Hello folks, I'm having some performance issues with the client-side part of my application. Basically, it renders a huge HTML table (about 20'000 cells in my testing scenario), without content....
5
by: Klaus Jensen | last post by:
Hi I am not sure, what is the best way to do this, and I hope somebody can offer some advice. :) I have 30 brands (from one table) out of one axis and 30 product categories (from another...
0
by: krokador | last post by:
This is doing my head in... We're starting to migrate our report-printing and such (forms included) to pdf - using xml files and nFOP with asp.net. In this case I have to print out a form which...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.