0

I have created one Class for auto complete text fields.

I want to use that Class and try to include my JTable cell fields, but it won't display.

Please advice

kleopatra
  • 51,061
  • 28
  • 99
  • 211
kanna
  • 39
  • 3
  • 4

2 Answers2

3
Community
  • 1
  • 1
mKorbel
  • 109,525
  • 20
  • 134
  • 319
3

(Assuming I understand the question)

You need to wrap your editor in TableCellEditor. Have a look at Using Other Editors an example.

Once you have it set up, you need to register the editor with the table.

One way is to register the editor with the column in question via the TableColumnModel

table.getColumnModel().getColumn(indexToColumnInQuestion).setCellEditor(tableCellAutoCompleteEditor);
MadProgrammer
  • 343,457
  • 22
  • 230
  • 366
  • actually i created one class called AutoCompletetext for autocompletetext.i try to include that class into my working jtable cellhow it ll possible – kanna Aug 09 '12 at 10:25
  • 2
    Did you read about `TableCellEditor`? Did you read "Using Other Editors". Basically, you will need to wrap you `AutoCompleteText` field in a `TableCellEditor` and register it with the column you want to use the editor on, as said in my answer. – MadProgrammer Aug 09 '12 at 10:34
  • +1 - despite of the _best ways_: in registering per-table vs. per-column there is no general best, just two paths for different contexts :-) – kleopatra Aug 09 '12 at 10:55