aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Getting focus on first field on Form load Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Getting focus on first field on Form load" Watch "Getting focus on first field on Form load" New topic
Author

Getting focus on first field on Form load

bhuwan tiwari
Greenhorn

Joined: Jan 04, 2001
Posts: 19
Hi,
As usual i wish to set my focus to first field of the form.
But by default it goes to the last component added.
i tried the method:
requestDefaultFocus()
requestFocus()
grabFocus()
but none of them is working when first time form is created.
plz suggest the way.
bhuwan
Helmut Lerch
Ranch Hand

Joined: Feb 11, 2001
Posts: 48
Hy,
Originally posted by bhuwan tiwari:
i tried the method:
requestDefaultFocus()
requestFocus()
grabFocus()
but none of them is working when first time form is created.

as far as I know you have to call this method after the container is visible.


[This message has been edited by Helmut Lerch (edited July 09, 2001).]
Harry Pfohl
Greenhorn

Joined: Apr 21, 2001
Posts: 17
Hi,
get first component of the panel and call seFocus(true) on it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting focus on first field on Form load