Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds


  Asked By: Sienna    Date: Aug 31    Category: Java    Views: 870

I have some questions about JTable:
1- how can set some columns of my table in editable mode and som uneditable?
2- how can I create in some columns controls such as JButton or something like link to a file that these address save to my DB?
3- can I determine # of table rows in run time? for example to number of records that I retrieve? When I create my table rows with Math.random() method in run time, my applet works, but when I set this with my number (by Integer.ParseInt(str)) it compile successfully but nothing appear! (I get the str from servlet that is one number In string format)
can anybody help me!



4 Answers Found

Answer #1    Answered By: Edna West     Answered On: Aug 31

Editing columns
Override these methods
boolean isCellEditable(int row,int column);
int getColumnCount();
String getColumnName(int c);

For counting your rows  
use this method   int getRowCount()

if you want to add any components in to your cell like button or combobox or checkbox

override its method

Answer #2    Answered By: Guilherme Silva     Answered On: Aug 31

I thanks very much for your complete answer, but I
want to set  my JTable row count. I want some method  like
JTale.setRowCount(variable), because I get my data in stream from
servlet and use in applet, I can't use model. When I use this
variable in :
Object[][] data= new Object[variable][constant]; and create  JTable
my applet  doesn't appear!

Answer #3    Answered By: James Evans     Answered On: Aug 31

would you tell me what's wrong with this codes.
i send you 2 files you have to compile  one of them and run  on your browser and tell me what do you want to do exactly.

Answer #4    Answered By: Clarence Nichols     Answered On: Aug 31

i have a question about JTable. i use defaultcelleditor to render a
JChechBox editor for a cell. i use this code:
TableColumn sportColumn = table.getColumnModel().getColumn(3);
JCheckBox ok = new JCheckBox();
sportColumn.setCellEditor(new DefaultCellEditor(ok));
i want to retreive this jchechbox value. that means sometimes i want
to know the value of this checkbox is true or false. what should i do?

Didn't find what you were looking for? Find more on JTable Or get search suggestion and latest updates.