JTable Column with Multiple Types

  • Follow


I'm very new to Java Swing and I'm trying to create a JTable.  I need a
column of the table to display multiple types, such as a String in row
1, a JComboBox in row2, and a JRadioButton in row 3 for example.

I'm working on an editor of sorts and I need to create a table to
display the properties of a selected component.  Something like a 2
column Property/Value Table where the value may be any object such as a
string, a list of possible values in a comboBox, etc.

Any help or code snipets would be greatly appreciated!

0
Reply MikeSmith813 4/14/2006 12:59:32 AM

see 
http://www.projectcool.com/tips/Tip/15851

-- 
Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-gui/200604/1
0
Reply judith 4/14/2006 11:19:18 AM


MikeSmith813@gmail.com wrote:
> I'm very new to Java Swing and I'm trying to create a JTable.  I need a
> column of the table to display multiple types, such as a String in row
> 1, a JComboBox in row2, and a JRadioButton in row 3 for example.
> 
> I'm working on an editor of sorts and I need to create a table to
> display the properties of a selected component.  Something like a 2
> column Property/Value Table where the value may be any object such as a
> string, a list of possible values in a comboBox, etc.
> 
> Any help or code snipets would be greatly appreciated!
> 

I see here 2 ways:
1. May be you want to change table structure -
instead of having table with 2 columns (property name - value)
you may have table with 2 rows (name - value) or even with one row
and column header as "names" part.
2. Override
JTable:public Component prepareRenderer(TableCellRenderer renderer, int 
row, int column)

where you may return component you want.

If you want your table to be editable see prepareEditor.
0
Reply Vova 4/17/2006 1:46:08 PM

2 Replies
726 Views

(page loaded in 0.056 seconds)

Similiar Articles:













7/24/2012 8:48:23 AM


Reply: