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 / January 2004

Tip: Looking for answers? Try searching our database.

Left Mouse Button Clicks Butting?

Thread view: 
hiwa - 05 Jan 2004 05:13 GMT
When we dispatch an event from button A's ActionListener onto Button
B, if the event specifies a left mouse button click, it seems to be
nullified, i.e. ineffective. Does someone know the cause of the
problem and solution?

<code>
/*pseudo code*/

AbuttonActionListener{
 actionPerformed(){
   Bbutton.dispatchEvent(new MouseEvent( ......., 3 /*or 2*/)):
//BUTTON3 or 2
 }
} //....This works fine
-------------------------------
AbuttonActionListener{
 actionPerformed(){
   Bbutton.dispatchEvent(new MouseEvent( ......., 1)):
//BUTTON1==LeftMouseButton
 }
} //....This doesn't work
-----------------------------
 actionPerformed(){
   Bbutton.dispatchEvent(new ActionEvent( .......)): //LeftMousen
triggers ActionEvent
 } //.....This also doesn't work
</code
Steve W. Jackson - 05 Jan 2004 19:49 GMT
>:When we dispatch an event from button A's ActionListener onto Button
>:B, if the event specifies a left mouse button click, it seems to be
[quoted text clipped - 23 lines]
>:  } //.....This also doesn't work
>:</code>

If your only objective is to have the response to your A button cause a
"click" to occur on the B button, why not simply call Bbutton.doClick()?

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama

hiwa - 06 Jan 2004 02:22 GMT
> If your only objective is to have the response to your A button cause a
> "click" to occur on the B button, why not simply call Bbutton.doClick()?
Thanks Steve. But we can't use doClick() method because it should
accompany modifyer, SHIFT and/or CTRL.

I now have found a solution using SwingUilities.notifyAction()
method. In order to use the method, I have rewritten the Bbutton's
ActionListner into an Action.


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.