wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes trapdoor to add'l functions to JFrame? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "trapdoor to add Watch "trapdoor to add New topic
Author

trapdoor to add'l functions to JFrame?

Kate Zoy
Ranch Hand

Joined: Feb 11, 2004
Posts: 33
I want my GUI to have a set of button that are invisible to the regular user, but that "super users" can type in F2, 9, ctrl-page up, F10 (some random sequence of key strokes) to make appear additional buttons. I guess I want a trapdoor, like in video games where you have to do up-up-left-up-right to get some cool upgrade. How should I go about doing this?
I found something online about key binding, so I figured I could key bind all of the above key strokes to one action method that would check if the entire sequence has been typed, which would trigger a setVisible(true) function to be called.
However, I can't even make the key binding work! So far, I have:

My "System.out.println( input );" statement never even happens! How can I make this key binding work, and is that the best way to go about doing this?

I know I could just create a key listener that would check all typed keys for the special characters, but I think that's a real waste of time. (this listener would be called EVERY time any user typed any letter and would not be effecient!)

Let me know if you know how to make my key binding work, or if you think there's a better way to go about doing this!
Thanks!
Kate
Kate Zoy
Ranch Hand

Joined: Feb 11, 2004
Posts: 33
Actually, I found a link that resolved my problem. I included it here so that someone else who has the same problem can refer to it as well Enjoy!

http://forum.java.sun.com/thread.jsp?forum=57&thread=240668&start=0&range=15
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: trapdoor to add'l functions to JFrame?