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 / General / January 2006

Tip: Looking for answers? Try searching our database.

I need modifier key state in an event that doesn't provide access to it.

Thread view: 
elrod@therod.org - 09 Jan 2006 13:21 GMT
I have a JTree with a TreeSelectionListener to load a form when the
node selection changes. I want to be able to perform a slightly
different action when the selection changes while the CTRL key is
pressed, but the TreeSelectionEvent does not provide access to the
modifier key state.
I am only necessarily interested in the modifier state if the selection
changes by a mouse click, so I could use a MouseListener for this case
if I could figure out a way to keep the TreeSelectionListener from also
loading the form for this case (I have to keep the
TreeSelectionListener method of switching forms for non-mouse-triggered
changes), since both listeners will fire for a mouse selection change.

So, in short, the ideal solution I seek is a way to know if the CTRL
key is pressed from within the TreeSelectionListener, and if that is
too impractical, then a way to keep the TreeSelectionListener from
performing a form load if the MouseListener is going to handle it.
elrod@therod.org - 09 Jan 2006 15:39 GMT
> I have a JTree with a TreeSelectionListener to load a form when the
> node selection changes. I want to be able to perform a slightly
[quoted text clipped - 12 lines]
> too impractical, then a way to keep the TreeSelectionListener from
> performing a form load if the MouseListener is going to handle it.

Or, perhaps a simpler question to answer; where does a new MouseEvent
originate? When it is generated, how is its 'modifiers' field
populated? I tried to delve into the java source, but did not find an
answer. I'm guessing (but hoping I am wrong) that the event is
generated by system code, and as such, there is no accessible function
for getting the modifiers.


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.