Help coderanch get a
new server
by contributing to the fundraiser
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

trapdoor to add'l functions to JFrame?

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic