Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / August 2004

Tip: Looking for answers? Try searching our database.

how to set focus to an AWT edit field?

Thread view: 
lucy - 20 Aug 2004 23:20 GMT
Hi, I am desinging GUI,

Everytime I update the plot in axes window, the focus on the edit UI control
is lost.

How can I set focus back to this edit field control to let the user continue
his input?

Thank you,

-Lucy
carmine - 21 Aug 2004 13:27 GMT
lucy ha scritto:
> Hi, I am desinging GUI,
>
[quoted text clipped - 7 lines]
>
> -Lucy

u use a thread check if the focus is lost and re-assign the focus on the
object u want
lucy - 21 Aug 2004 21:16 GMT
> lucy ha scritto:
> > Hi, I am desinging GUI,
[quoted text clipped - 11 lines]
> u use a thread check if the focus is lost and re-assign the focus on the
> object u want

That's exactly waht I was asking: how to re-assign the focus on the object I
want ?
ak - 21 Aug 2004 22:09 GMT
> > > Everytime I update the plot in axes window, the focus on the edit UI
> control
[quoted text clipped - 13 lines]
> That's exactly waht I was asking: how to re-assign the focus on the object I
> want ?
Component#requestFocus();

Signature

Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader

lucy - 22 Aug 2004 19:17 GMT
> > > > Everytime I update the plot in axes window, the focus on the edit UI
> > control
[quoted text clipped - 14 lines]
> I
> > want ?

> Component#requestFocus();

Tried, no use....
requestFocus() refused my request and I did not get back my focus... this is
weired....
Paul Lutus - 22 Aug 2004 20:14 GMT
/ ...

> Tried, no use....
> requestFocus() refused my request and I did not get back my focus... this
> is weired....

To get assistance, you need to post a small, complete, compilable code
example that shows the problem.

Signature

Paul Lutus
http://www.arachnoid.com

ak - 23 Aug 2004 00:39 GMT
> > Component#requestFocus();
>
> Tried, no use....
> requestFocus() refused my request and I did not get back my focus... this is
> weired....

this is simple - your request was not refused, the problem is that _after_
your request
focus gone because of some processing.
Try this form:

SwingUtilities.invokeLater(new Runnable() {
   myComponent.requestFocus();
});

Signature

Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader

Paul Lutus - 21 Aug 2004 23:10 GMT
/ ...

>> u use a thread check if the focus is lost and re-assign the focus on the
>> object u want
>
> That's exactly waht I was asking: how to re-assign the focus on the object
> I want ?

Well, strictly speaking, you can't force the reassignment. But if you have
the desired object call requestFocus(), it will probably get focus in a
reasonable time.

Signature

Paul Lutus
http://www.arachnoid.com

ak - 22 Aug 2004 01:28 GMT
> Everytime I update the plot in axes window, the focus on the edit UI control
> is lost.
>
> How can I set focus back to this edit field control to let the user continue
> his input?
the right question is - why you lost focus?
Post short compilable code, may be we'll find some mistake.

Signature

Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader

lucy - 22 Aug 2004 19:19 GMT
> > Everytime I update the plot in axes window, the focus on the edit UI
> control
[quoted text clipped - 5 lines]
> the right question is - why you lost focus?
> Post short compilable code, may be we'll find some mistake.

I am trying to do some "automatic" focusing for some other applications, not
written by me, but I need to focus on a edit control on it in order to save
some energy...


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.