File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Focus Gained event Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply locked New topic
Author

Focus Gained event

John Fernandas
Greenhorn

Joined: Dec 15, 2011
Posts: 3
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
Bartender

Joined: Oct 14, 2005
Posts: 18716
    
    8

Moving to the Swing forum...
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> 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

Joined: Oct 16, 2003
Posts: 1085
    
  10

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.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4642
    
    5

Continued here: http://www.coderanch.com/t/562376/GUI/java/Capturing-all-type-inputs-JTextField

I'm locking this thread.


luck, db
There are no new questions, but there may be new answers.
 
Consider Paul's rocket mass heater.
 
subject: Focus Gained event