KeyAdapter not getting input on JLabel when Frame maximized in windows

C

chadsinge

I have a JLabel that has a KeyAdapter attached to it that waits for
input, and when the user enters a specific string, it does something.
This works fine when the window isn't maximised, I can see the input in
System.out's that I added, but when I maximise the window, I can no
longer see that the JLabel is receiving the input. Could this be a bug
in the Windows JRE? I'm using Windows 2k and Java 1.4.2_11.
 
V

Vova Reznik

I have a JLabel that has a KeyAdapter attached to it that waits for
input, and when the user enters a specific string, it does something.
This works fine when the window isn't maximised, I can see the input in
System.out's that I added, but when I maximise the window, I can no
longer see that the JLabel is receiving the input. Could this be a bug
in the Windows JRE? I'm using Windows 2k and Java 1.4.2_11.
Looks like your label lost the focus.
Why do you use JLabel for user input instead of JTextField for example?
 
C

chadsinge

we're basically having them enter a sort of password to unlock a hidden
menu. using a text field would be too obvious.
 
V

Vova Reznik

we're basically having them enter a sort of password to unlock a hidden
menu. using a text field would be too obvious.

Then javax.swing.JPasswordField.
 
C

chadsinge

I didn't even want to give the appearance that there was an option to
type something in. You had to be in the know. I finally chose a
JTextField and modified the Caret, Document, and Cursor to all be
hidden/not blink/etc., so it was completely transparent.
 

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,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top