File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTable and JRadioButtons

 
Lina Mahl
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My JTable is not showing my JRadioButtons?
I am using a TableModel and there i do have a method called "public Class getColumnClass(int c)"
What am I doing wrong?
 
Eduard Jodas
Ranch Hand
Posts: 80
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want a radio button to be showing on the JTable as a cell, you need to provide it through a TableCellRenderer. TableCellRenderers are provided either by TableColumn or cell value Class.
Thus, I would access the desired TableColumn (through the TableColumnModel) and set its TableCellRenderer.
In addition to this, if you want this radio button to be editable, you should provide a TableCellEditor as well.
Moreover, if only one radio button can be selected in the whole column, make sure the whole column is repainted when selection changes.
But why do you need the radio button? To select the flight to book seats for? That can be accomplished by allowing single selection of the table rows. It is much easier than having radio buttons.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic