Search |
||
Log me in, log me out!Posted by rah003 on November 2, 2007 at 8:41 AM PDT
There have been for long time open enhancement request in SwingX for notification about caps lock being switched on in JXLoginPanel. Over a time it acquired quite few votes (in comparison to your average swingx issue, not that 10 votes is much in absolute numbers) so I thought lets do this, it can't be that difficult. In your average C program you just query the driver when you want to know the state of the caps lock or any other key for that matter. Not so in your average java program. Don't get me wrong, I know there is a method to get the state of the locking key The question remains: how to implement support or checking caps lock when function provided by the JDK doesn't do the job properly? You can rely on
The second point could be possibly resolved by adding timer to the implementation which would check for the state by producing fake keyboard events, but it would also increase complexity of the feature (and thus putting even more weight on the first point - possible implementation issues). Hopefully we can remove all this once the LockingKeyState can be obtained reliably on all platforms by querying jdk method. In the mean time I would be really interested in hearing from you how it works, or doesn't for that matter.
And since everybody naturally loves runnable demos here is one that shows Login Panel at work: BTW, as you will notice, this little demo is signed and it needs to be signed in order for CapsLock notification to work. While this might be annoying at first consider this: When your application is distributed over the web and you require user to pass their password in, you should sign your application anyway. When running any app locally CapsLock notification will work without signing, when running unsigned app over the web the support will be switched off automatically and no exceptions thrown. Enjoy! »
Related Topics >>
Java Desktop Comments
Comments are listed in date ascending order (oldest first)
|
||
|
|