This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Want to know whether CAPS LOCK key is ON

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am developing a user management GUI in swing.
In that I am having a screen where user can change his password.

Now I want to display a POP Up message to the user if the CAPS LOCK key is ON when the any of the password field gets focused.

Is there any solution to this problem?
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Try getLockingKeyState(int keyCode) method from java.awt.Toolkit class.

where the key code for caps lock key is java.awt.event.KeyEvent.VK_CAPS_LOCK

-Srivatsa Katta
 
Tapan Maru
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Srivatsa

I have tried that code but I am getting UnSupportedOperationException when I run the code

I am trying the code on RedHat Linux 9..

Does it make any difference? Should I try out on Windows XP platform or on Solaris platform?

Tapan Maru
 
Tapan Maru
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Srivatsa

I have tried that code but I am getting UnSupportedOperationException when I run the code

I am trying the code on RedHat Linux 9..

Does it make any difference? Should I try out on Windows XP platform or on Solaris platform?
 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
maybe this thread may interest you
 
Srivatsa Katta
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tapan,

I tried on windows OS its giving me the correct status. Am not sure about other platforms.

Regards,
Srivatsa Katta
 
Srivatsa Katta
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Is this how you are testing, this works fine on windows ideally it should work on all platforms.

stats is true if caps key is on, else false.

-Srivatsa Katta
 
Tapan Maru
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have used it as the same way you have written the code!! But it is not working on the RedHat9 Linux.... I will try on Windows today so lets see....

Ideally it should work on all platforms (Java is platform independent....)
Anyways, thanks for the help, keep posting....
 
Tapan Maru
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it is working in Windows XP fine at my side also. Lets see if I can get any solution!!!
 
Do not threaten THIS beaver! Not even with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!