I need to trigger a JList with items when I press @ in a JTable's row in Swing, when the user selects an item the JList should disappear, anyone know how I can achieve this?
Asked
Active
Viewed 115 times
-1
-
Just curious, why the requirement for the @ symbol? Would you not want the user to see the valid options in another scenerio? – splungebob Feb 28 '14 at 21:25
-
Yes, the "@" is only an example, I need to trigger the list when the user press a special symbol. – iberck Feb 28 '14 at 21:30
2 Answers
0
There's an example in the tutorials for that exact scenario: Using A Combobox As A Table Editor. You could trigger the start of the editor (via the @ symbol) with KeyBindings

splungebob
- 5,357
- 2
- 22
- 45
-
-
`The example has no relation with the scenario described` Oh, so you *already know* how to use a combobox as a table cell editor? Great. I must've missed that in the OP. Now you just need to apply the KeyBindings for the "@" symbol and you're all set – splungebob Mar 01 '14 at 15:55
-1
Have you tried using the KeyPressed event? You should be able to see if the @ has then been entered, then show the JList.

Adam Carlin
- 244
- 1
- 3
- 15
-
-1 there is no `onKeyPress` event. Even if there was you should be using `Key Bindings` with Swing. – camickr Feb 28 '14 at 21:22
-
Sorry I mean KeyPressed. Key bindings is probably the best way, forgot about them! – Adam Carlin Feb 28 '14 at 21:30