• 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

[JTable] problem with edition in a JTextField

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
I have a JXTable that contains a column called "Delay".
Delay is a Label when it is not edited, and a JTextField upon edition.
I have a few lines in my JXTable.
When i click on my first Delay cell, i enter a value, then i press Enter and i get the focus on the next JTextField, and all the text is selected to be replaced (with this trick


Problem is, if i press the up arrow key or the down arrow key, the selected cell is the right one, but it is not in mode edition anymore (i.e. the JLabel appears, not the JTextEdit) and the focus is not on the field anymore but on the JXTable.
If i start inputing something, it adds to the value already present in the field: ex : if there was 24, i go on this cell from the previous one using Enter, i write 5, at the end i have 5. If i go on this cell from the previous one using the arrows, and i write 5, at the end i get 245. And i want the automatic selection as well for the Up and Down arrow keys cases.

Please help me
 
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then you need to override your Up and Down keyevents. That will give your desired result.
 
Nicolas Daudin
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And how can i do this?
By a field.addKeyListener()...?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic