• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Keymap nonsense

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Everything you need to know about such things is right here in the Java Developer's Almanac.
 
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic