Swing, customize the behavior of mnemonic access

S

subwiz

I have a JLabel, which has a mnemonic binding to a JTextField. When I
access using the mnemonic key-combination, the cursor is placed in the
JTextField. But I want to override this behavior and make a complete
selection of the text in the JTextField also. Is this possible?
 
J

John B. Matthews

subwiz said:
I have a JLabel, which has a mnemonic binding to a JTextField. When I
access using the mnemonic key-combination, the cursor is placed in the
JTextField. But I want to override this behavior and make a complete
selection of the text in the JTextField also. Is this possible?

See JTextComponent#selectAll(), for example:

<http://java.sun.com/javase/6/docs/api/javax/swing/text/JTextComponent.html>
<http://java.sun.com/docs/books/tutorial/uiswing/components/textfield.html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top