jfilechooser and keylistener
hi,
I'm a noob in java. I have a simple application to open file with JFileChooser. When I press down key on keyboard the selection go down etc. For istance, if want to obtain the same thing pressing "p" key, what could I do?
Is it possible?
sorry for my bad english and for the dummy question
regards
# 2
of course you can. There are two reasons. 1) for exercise and understand how keyboard and jfilechooser interacts, 2) more important, I want to use bluetooth to make interact mobile phone keyboard and jfilechooser...
I had look for a component in jfilechooser.. i was suppose there is a jlist in jfilechooser container but it is not true..
thanks lot
Message was edited by:
emanuele.g
# 4
> 1) for exercise and understand how keyboard and jfilechooser interacts
Well, the key board and jfilechooser don't interact. JFileChooser is simply a panel consisting of other components added to the panel. So the keyboard interacts with the other components added to the panel.
So start with something simpler if you want to understand how KeyStrokes and Actions are used in Swing. Read the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html]How to Use Key Bindings[/url].
Since the JFileChooser appears to be using a JList you would then need to understand how the key bindings are used on the list. You would then need to somehow access the list from the UI or simply iterate through all the components added to the JFileChooser until you find a JList. Once you find the JList you can then assign the "P" keystroke to the same action as is being used by the "down" keystroke.