Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

trapdoor to add'l functions to JFrame?

 
Kate Zoy
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic