Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #2579 > unrolled thread

Component Focus

Started by"Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this>
First post2011-04-27 15:39 +0000
Last post2011-04-27 15:40 +0000
Articles 6 — 3 participants

Back to article view | Back to comp.lang.java.gui


Contents

  Component Focus "Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000
    Re: Component Focus "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000
      Re: Component Focus "Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000
    Re: Component Focus "Larry Barowski" <larry.barowski@THRWHITE.remove-dii-this> - 2011-04-27 15:39 +0000
      Re: Component Focus "Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000
        Re: Component Focus "Larry Barowski" <larry.barowski@THRWHITE.remove-dii-this> - 2011-04-27 15:40 +0000

#2579 — Component Focus

From"Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this>
Date2011-04-27 15:39 +0000
SubjectComponent Focus
Message-ID<1191425748.265173.17620@g4g2000hsf.googlegroups.com>
  To: comp.lang.java.gui,comp.l
Is there a way to track component focus across an entire GUI?  What I
am trying to do is keep toolbars updated (by updating their
corresponding actions) depending on what component is currently in
focus.

So...


MainView - this is parent view that holds all project and
propertyviews for my application.  MainView contains a method called
"updateActions" which, when called, turns actions on and off depending
on the current status of the application.

What I'd like to have happen is that, when any focus change occurs,
the updateActions method is called.  Everything I've tried so far is
not accomplishing this.  Any insight provided would be much
appreciated.


Thanks

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#2580

From"Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this>
Date2011-04-27 15:39 +0000
Message-ID<E8SdneFiztXWJZ7anZ2dnUVZ_g6dnZ2d@wavecable.com>
In reply to#2579
  To: comp.lang.java.gui,comp.l
Jason Cavett wrote:
> Is there a way to track component focus across an entire GUI?  What I
> am trying to do is keep toolbars updated (by updating their
> corresponding actions) depending on what component is currently in
> focus.
> 
> So...
> 
> 
> MainView - this is parent view that holds all project and
> propertyviews for my application.  MainView contains a method called
> "updateActions" which, when called, turns actions on and off depending
> on the current status of the application.
> 
> What I'd like to have happen is that, when any focus change occurs,
> the updateActions method is called.  Everything I've tried so far is
> not accomplishing this.  Any insight provided would be much
> appreciated.
> 
> 
> Thanks
> 
Has everything you've tried included adding a focus listener on all your 
components?

-- 
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2586

From"Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this>
Date2011-04-27 15:39 +0000
Message-ID<1191427937.637147.132860@r29g2000hsg.googlegroups.com>
In reply to#2580
  To: comp.lang.java.gui,comp.l
On Oct 3, 11:30 am, Daniel Pitts
<newsgroup.spamfil...@virtualinfinity.net> wrote:
> Jason Cavett wrote:
> > Is there a way to track component focus across an entire GUI?  What I
> > am trying to do is keep toolbars updated (by updating their
> > corresponding actions) depending on what component is currently in
> > focus.
>
> > So...
>
> > MainView - this is parent view that holds all project and
> > propertyviews for my application.  MainView contains a method called
> > "updateActions" which, when called, turns actions on and off depending
> > on the current status of the application.
>
> > What I'd like to have happen is that, when any focus change occurs,
> > the updateActions method is called.  Everything I've tried so far is
> > not accomplishing this.  Any insight provided would be much
> > appreciated.
>
> > Thanks
>
> Has everything you've tried included adding a focus listener on all your
> components?
>
> --
> Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>

My apologies for not adding that, no I haven't tried that method, but
only due to the fact that it would be extremely time consuming for
something that doesn't give a lot of return.  Also, considering the
size of the application (incl. all JTextFields, JTrees, Panels, etc)
this is something I'd like to do as a last resort.

Basically, I'm wondering if there's an easier way that I hadn't
thought of.  If not, I can use the method you described or just not
worry about it at all.

Thanks, though.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2588

From"Larry Barowski" <larry.barowski@THRWHITE.remove-dii-this>
Date2011-04-27 15:39 +0000
Message-ID<8MWdnRO7kLuGaJ7anZ2dnUVZ_g2dnZ2d@comcast.com>
In reply to#2579
  To: comp.lang.java.gui,comp.l

"Jason Cavett" <jason.cavett@gmail.com> wrote in message 
news:1191425748.265173.17620@g4g2000hsf.googlegroups.com...
> Is there a way to track component focus across an entire GUI?  What I
> am trying to do is keep toolbars updated (by updating their
> corresponding actions) depending on what component is currently in
> focus.

You can use Toolkit.addAWTEventListener with a
FOCUS_EVENT_MASK.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2594

From"Jason Cavett" <jason.cavett@THRWHITE.remove-dii-this>
Date2011-04-27 15:40 +0000
Message-ID<1191511296.807248.52040@r29g2000hsg.googlegroups.com>
In reply to#2588
  To: comp.lang.java.gui,comp.l
On Oct 3, 4:08 pm, "Larry Barowski" <MElarrybar-AT-
eng_DOT_auburnANOTHERDOTeduEND> wrote:
> "Jason Cavett" <jason.cav...@gmail.com> wrote in message
>
> news:1191425748.265173.17620@g4g2000hsf.googlegroups.com...
>
> > Is there a way to track component focus across an entire GUI?  What I
> > am trying to do is keep toolbars updated (by updating their
> > corresponding actions) depending on what component is currently in
> > focus.
>
> You can use Toolkit.addAWTEventListener with a
> FOCUS_EVENT_MASK.

Awesome...that worked (pretty well, I might add).

After doing a little research though, Sun seems to suggest that this
can cause speed issues within the GUI.  Is this true?  Have you ever
noticed a problem as a result (since, essentially, you're capturing
every event that happens in the system).

Thanks again.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#2595

From"Larry Barowski" <larry.barowski@THRWHITE.remove-dii-this>
Date2011-04-27 15:40 +0000
Message-ID<Dridnb-5ToCrTZjanZ2dnUVZ_qSonZ2d@comcast.com>
In reply to#2594
  To: comp.lang.java.gui,comp.l

"Jason Cavett" <jason.cavett@gmail.com> wrote in message 
news:1191511296.807248.52040@r29g2000hsg.googlegroups.com...
> Awesome...that worked (pretty well, I might add).
>
> After doing a little research though, Sun seems to suggest that this
> can cause speed issues within the GUI.  Is this true?  Have you ever
> noticed a problem as a result (since, essentially, you're capturing
> every event that happens in the system).

With all the time consuming things that go on in a gui, this should
be a tiny contribution. It is used in jGRASP to implement
focus-follows-mouse behavior within a JDesktopPane. The mask
is for focus, mouse, and mouse motion events. When ffm is
turned off, the listener is removed. Any difference in speed for
the ffm on and off states is undetectably small.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web