*
The moose likes Swing / AWT / SWT and the fly likes Jtable cells Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Jtable cells" Watch "Jtable cells" New topic
Author

Jtable cells

ben riches
Ranch Hand

Joined: Nov 08, 2002
Posts: 126
Hello All,
How can I get every cell within my JTable to have the two combo boxes that are in the code below to display what currently dispaly.
Thanks
Ben
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

You would just need to make a TableCellRenderer using the panel holding the two comboboxes ( and a TableCellEditor, too... since you obviously expect users to select values from the comboboxes and change the cell's value). However, why would one cell hold two values? Why not use separate columns to hold each set of data?


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
ben riches
Ranch Hand

Joined: Nov 08, 2002
Posts: 126
Originally posted by Nathan Pruett:
You would just need to make a TableCellRenderer using the panel holding the two comboboxes ( and a TableCellEditor, too... since you obviously expect users to select values from the comboboxes and change the cell's value). However, why would one cell hold two values? Why not use separate columns to hold each set of data?


I have the TableCellRenderer class but how would I do the suggested above.
Also I do want to coulmns the first column would get the Table names from the DataBase the second column gets the colum names from that table the user selected in the column.
Coould you helo me construct my code for the table cell renderer?
what I have at the moment
 
Consider Paul's rocket mass heater.
 
subject: Jtable cells
 
Similar Threads
JComboBox Help!
why do I get this exception
why is my JTable not showing up?
Stll having problems
Thowing to many errors