aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How can i insert JRadioButton to Cell in JTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How can i insert JRadioButton to Cell in JTable" Watch "How can i insert JRadioButton to Cell in JTable" New topic
Author

How can i insert JRadioButton to Cell in JTable

Alon Goldfeld
Greenhorn

Joined: Mar 19, 2004
Posts: 4
Hi,

I need to insert JRadioButton to Cell in JTable.
I can insert JCheckBox, JComboBox, JTextFeild to JTable,
but DefaultCellEditor hasn't editor for JRadioButton.

Anybody have ideas?

I need help, immidiately!!!

HEEEEEEEEEEEEEEEEEEEEEEEEEEEELP!!!
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 804
I believe radio buttons don't work alone, they work in groups. Have you tried adding the radio buttons to a ButtonGroup, then adding the ButtonGroup to the cell using the add method?


Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
Sebastiaan Kortleven
Ranch Hand

Joined: Mar 12, 2004
Posts: 81
A ButtonGroup has no visual representation...

What do you wish to achieve by adding a radiobutton to the table?
Geza Kovacs
Greenhorn

Joined: Nov 10, 2004
Posts: 4
Originally posted by Alon Goldfeld:

I need to insert JRadioButton to Cell in JTable.
I can insert JCheckBox, JComboBox, JTextFeild to JTable,
but DefaultCellEditor hasn't editor for JRadioButton.


You have to use custom renderers and editors.

Quick solution:

Renderer


Editor
Geza Kovacs
Greenhorn

Joined: Nov 10, 2004
Posts: 4
And register the renderer/editor in the table:

Alon Goldfeld
Greenhorn

Joined: Mar 19, 2004
Posts: 4
Thank's, but how can i add this radiobuttons to the group.
Number of radiobuttons not constant.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can i insert JRadioButton to Cell in JTable