3

can anyone help me with this , I have a jtable and I want to search for the data in it with jtextfield , as the user types, suggestions appears in a drop down list and select from it , then the user select it and the results appears in the table.

hisham91
  • 53
  • 1
  • 2
  • 5
  • 2
    Please add some code that you have been working on. The question doesn't provide any details. – Subash Jan 22 '12 at 00:04

2 Answers2

4

yes that possible two ways

1) easiest without implement for autocomplete JTextField, - JTable has implemented Sorting and Filtering code example in the tutorial

2) by implement AutoComplete JComboBox / JTextField (read whole thread because there is most excelent alternative implemented in the SwingX) and for JTable to set Filtering

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

For the JTextField, use getText() to get the input(but you have to update that constantly). For the drop down menu, use what's called an editable combo box - http://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html#editable has an explanation.

Jimmt
  • 852
  • 2
  • 11
  • 29