Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
    Bookmark Topic Watch Topic
  • New Topic

Focus Gained event

 
John Fernandas
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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
 
Paul Clapham
Sheriff
Posts: 21319
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Report post to moderator
Moving to the Swing forum...
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Likes 3
  • Mark post as helpful
  • send pies
  • 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.
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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.
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Report post to moderator
Continued here: http://www.coderanch.com/t/562376/GUI/java/Capturing-all-type-inputs-JTextField

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