Re: Using a JComboBox in certain cells in a JTable
- From: Vova Reznik <byRequest@xxxxxxxxxxxx>
- Date: Thu, 29 Sep 2005 17:54:10 GMT
1. Override JTable
public Component prepareRenderer(TableCellRenderer,int,int)
2. Override DefautlTableCellRenderer
public Component getTableCellRendererComponent(JTable,Object,
boolean,boolean,int,int) 3. Create your own renderer (has to implement TableCellRenderer)
I prefer #3.
Leif Bloomquist wrote:
Hi all,
Using the techniques from the following page, I've set up a JTable with JComboBoxes in one column of cells. http://javaalmanac.com/egs/javax.swing.table/ComboBox.html
However, what I'd really like to do is have a JComboBox as the editor/render for only certain cells in the column, not the entire column. I found a verbal solution here: https://lists.xcf.berkeley.edu/lists/advanced-java/2000-March/007761.html
So I get what they're saying - check the row that is currently being edited/rendered, and return either a JComboBox for those rows, or a "normal" JTable cell. (Is it a JTextField?) But I'm a bit fuzzy on where/when I should actually put in the code that does this. Can anyone help or provide a short example?
Thanks, Leif
.
- References:
- Using a JComboBox in certain cells in a JTable
- From: Leif Bloomquist
- Using a JComboBox in certain cells in a JTable
- Prev by Date: Re: Using a JComboBox in certain cells in a JTable
- Next by Date: Re: Can I use an Action, but have diff text for JButton versus JMenuItem?
- Previous by thread: Re: Using a JComboBox in certain cells in a JTable
- Next by thread: Mouse Cursor with hourglass and pointer
- Index(es):