• Post Reply Bookmark Topic Watch Topic
  • New Topic

Keymap nonsense  RSS feed

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've got a JTextPane. It's a happy JTextPane. But i want it such that upon hitting the enter key whilst typing, i run method EnterPressed(). All i've found are (is?) endless Keymaps, KeyStrokes, KeyEvents, AWTEvents, all of which are just interfaces. I figured out that you can just steal the Keymap from the getKeyMap() method of the JTextPane, but attemtping to fun the setActionForStrokes forces one to try to get a keystroke from a keyevent, and KeyEvents don't have a useful constructer that just takes the int of the KeyMap you want, and it also forces you to figure out the non-sensical Action class which to use you'll have to implement about the 3rd interface, and normally i wouldn't have such a mosterous run-on but you see how near to insanity i am...
Easy answer?
P.S. i really don't mean to pester, but i've got a thread a ways down here that could really use a good anserin'... GBApplet (explains why it's not in the applet forum)
 
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Everything you need to know about such things is right here in the Java Developer's Almanac.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!