Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #4851
| From | Jeff Higgins <jeff@invalid.invalid> |
|---|---|
| Newsgroups | comp.lang.java.gui |
| Subject | Re: Debugging Focus problem |
| Date | 2011-12-22 17:10 -0500 |
| Organization | A noiseless patient Spider |
| Message-ID | <jd09jv$adb$1@dont-email.me> (permalink) |
| References | <Xns9FC3ACBF370B4jpnasty@94.75.214.39> |
On 12/22/2011 04:54 PM, Novice wrote:
> I'm having a problem putting the focus where I want it in certain cases in
> a class I am revising. In most circumstances, the focus is where the
> program is telling it to be but I'm having one annoying situation where it
> isn't, specifically when I first display the GUI.
>
> The last statement I execute before setting the JFrame visible is:
> myTextArea.requestFocus();
>
> However, the focus doesn't appear to be on ANY control of my GUI when it
> comes up. This impression was reinforced when I added this line after
> trying to set the focus on myTextArea:
> System.out.println("The focus is currently on: " + getFocusOwner());
>
> That statement indicated that the focus was on null.
>
> Why would my requestFocus() be ignored - or honored but then immediately
> removed? - when first displaying the GUI but work perfectly after any other
> event? In each case, I set the focus on the exact same JTextArea.
>
> I'm using Java 1.6.18 in Eclipse 3.7.
>
<http://docs.oracle.com/javase/tutorial/uiswing/misc/focus.html>
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Next in thread | Find similar
Debugging Focus problem Novice <novice@example..com> - 2011-12-22 21:54 +0000
Re: Debugging Focus problem Jeff Higgins <jeff@invalid.invalid> - 2011-12-22 17:10 -0500
Re: Debugging Focus problem Novice <novice@example..com> - 2011-12-22 22:45 +0000
Re: Debugging Focus problem Roedy Green <see_website@mindprod.com.invalid> - 2011-12-22 19:54 -0800
csiph-web