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

Disable Enter key in a JTable

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Can someone tell what to use to disable the enter key in a JTable? I switched over from JAVA 1.2.2 to JAVA 1.3.0 which I used the command "inventoryTable.unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0))", which worked fine. But in JAVA 1.3.0, it is now obsolete. Any example would be helpful.
Thanks in advance,
Marc Bourdon
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Well, we were talking in Beginner, and then you re-posted over here. Is there something that you didn't understand about KeyListeners and consume()?
 
marc bourdon
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi Cindy, you replied twice to my post in the beginner and intermediate discussion, I re-posted in the intermediate because I didn't see my post in the beginner forum, was having problems with the internet proxy stuff at work.
Anyhow, concerning this message: "Can someone tell what to use to disable the enter key in a JTable? I switched over from JAVA 1.2.2 to JAVA 1.3.0 which I used the command "inventoryTable.unregisterKeyboardAction(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0))", which worked fine. But in JAVA 1.3.0, it is now obsolete."
I already have a KeyListener in the JTable which captures my entry when I press the enter key but the default setting for the enter key in a JTable is to do a skip to the next line. So when I press the enter key, it skips to the next line and selects the line below the one I want. What I wish to do is disable the enter key so that it stays on the same line that I press the enter. But when I was using JAVA 1.2.2, using the unregisterKeyboardAction disabled the enter key, what replaced this command in JAVA 1.3.0?
An example would be great.
Thanks in advance,
Marc Bourdon
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
We really don't need to spawn the same dicussion in multiple forums. I see you also opened one in Advanced. The problem is that people responding to one don't see the others, and end up wasting time by addressing points already made elsewhere. I'm closing the duplicate threads; see the original here. Thanks.
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic