permaculture playing cards*
The moose likes Swing / AWT / SWT and the fly likes RequestFocus doesn't work? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "RequestFocus doesn Watch "RequestFocus doesn New topic
Author

RequestFocus doesn't work?

Zee Ho
Ranch Hand

Joined: Jul 20, 2004
Posts: 128
Hi ranchers, I want to let second component of the JFrame to be focused, but seems the requestFocus didn't work, my first component is the combobox, it gains the focus automatically, why I can not move the focus to the specific component


SCJP 1.4<br />SCWCD 1.3<br />SCJD<br />SCBCD<br />IBM Xml Cert in progress
Barry Andrews
Ranch Hand

Joined: Sep 05, 2000
Posts: 523

What kind of Component is it? By default, some Components are not focusable, like labels, panes, etc. starting with Java 1.4. Also if the Component is not displayable, enabled, etc. it will not be focusable. If this does not help, try posting a snippet of code.
Zee Ho
Ranch Hand

Joined: Jul 20, 2004
Posts: 128


In the UIUtils I just do very simple things to set some attribute to the
JTextField


[ April 09, 2005: Message edited by: Zee Ho ]
Zee Ho
Ranch Hand

Joined: Jul 20, 2004
Posts: 128
I request the focus on criteria_name which is a JTextField, but weird. it never gain it.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
you were given the answer here
>Also if the Component is not displayable, enabled, etc. it will not be focusable.

here's a compilable version of your code, to demonstrate


Zee Ho
Ranch Hand

Joined: Jul 20, 2004
Posts: 128
reslovced, thx
 
 
subject: RequestFocus doesn't work?