Using a JComboBox in certain cells in a JTable



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

--
Leif Bloomquist
leif (at) schema factor (dot) com
http://home.ica.net/~leifb/


.



Relevant Pages

  • Re: JComboBox as a CellEditor in a JTable in Mac LAF
    ... >>I've got a table where I want to be able to edit the cells using a ... >>JComboBox get clipped when the table is in edit mode. ... > Are the table and cell editor using the same font size? ...
    (comp.lang.java.gui)
  • Re: extended JTable... trying to add a row....
    ... > causes my application to crash when trying to ... >insert a JComboBox into one of its cells. ... Seems to me you or someone else asked this exact same question. ...
    (comp.lang.java.programmer)
  • Re: Problem in Coloring JTable cell to indicate that is editable
    ... particular value is chosen in the JComboBox, some other cells in the ... Please find sample program, and give some suggentions. ...
    (comp.lang.java.gui)
  • JComboBoxes in a JTable
    ... I have an app where cells in a table each need to display a set of values. ... I can put a JComboBox into the cells of a column by setting the column ...
    (comp.lang.java.help)