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

Focus Gained event

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
hi all,

I am having 4 Jtext fields in java swing frame the problem is i have to move the focus from one textfield to other text field
if the curser moves from one text to the other the text in that field need to be selected i dont know how to do this so give me the proper coding associate with this issue


Thanks in advance
John
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Moving to the Swing forum...
 
Ranch Hand
Posts: 4632
  • Likes 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
> so give me the proper coding associate with this issue

these are the steps:

1) take your feet off the desk
2) open the apidocs for JTextField
3) read all the methods, including those inherited

you'll find what you seek.
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Welcome to the Ranch!

And, you have partially answered the question yourself. You need to write a FocusListener through the focusGained method:
The tutorial is the best place to start.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Continued here: https://coderanch.com/t/562376/GUI/java/Capturing-all-type-inputs-JTextField

I'm locking this thread.
 
    Bookmark Topic Watch Topic
  • New Topic