aspose file tools*
The moose likes Beginning Java and the fly likes SETTING FOCUS ON A TEXT FIELD Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "SETTING FOCUS ON A TEXT FIELD" Watch "SETTING FOCUS ON A TEXT FIELD" New topic
Author

SETTING FOCUS ON A TEXT FIELD

RAY CARNES
Greenhorn

Joined: May 02, 2000
Posts: 11
I want to put the pointer (or hatever it's called in a text field) onto the text field so the user can just start typing. I haven't been able to find the method to do this.
Todd M Bush
Greenhorn

Joined: Apr 26, 2000
Posts: 22
To give a component the default focus when the window first opens, you must use the component.requestFocus() command in the window opened event. Like this....
frame.addWindowListener(new WindowAdapter() {
public void windowOpened(WindowEvent we) {
textfield.requestFocus();
}
});
hope this helps
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SETTING FOCUS ON A TEXT FIELD