Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Help > Re: JToggleButt...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 11 Topic 16060 of 16204
Post > Topic >>

Re: JToggleButton event firing

by Redbeard <tom.cowdery@[EMAIL PROTECTED] > May 7, 2008 at 08:25 PM

On May 7, 9:55 pm, Mark Space <marksp...@[EMAIL PROTECTED]
> wrote:
> Redbeard wrote:
> > It appears that the JToggleButton fires the event to change its state
> > when the button is released rather than when it is pressed.
>
> So it may not do what you want because JToggleButton is designed for
> radio buttons and check boxes.  What you describe is desired behaviour
> for those UI items.
>
> Try going back to a regular old JButton.  You'll have to manaully set
> the icon, but that doesn't sound like any more work than what you've
> already tried.
>
> What you want to do is use MouseEvents.  You may have to specifically
> enable them.  See the Java docs:
>
> <http://java.sun.com/javase/6/docs/api/java/awt/event/MouseEvent.html>
>
> MOUSE_RELEASED is what you want, I think.

Thanks for the reply.  You are correct, MouseReleased would be the
method I'd have to implement in the MouseListener interface.  But
JButton doesn't have any analog for the setSelected or isSelected
methods found in JToggleButton, and I use those quite a bit.  I'd have
to do more than just implementing the MouseListener interface to use a
JButton.  Before I do that, I'll hold off a bit in case someone else
knows a way to modify the JToggleButton's behavior.
 




 11 Posts in Topic:
JToggleButton event firing
Redbeard <tom.cowdery@  2008-05-07 19:18:08 
Re: JToggleButton event firing
Mark Space <markspace@  2008-05-07 19:55:34 
Re: JToggleButton event firing
Redbeard <tom.cowdery@  2008-05-07 20:25:13 
Re: JToggleButton event firing
Knute Johnson <nospam@  2008-05-07 22:17:56 
Re: JToggleButton event firing
Roedy Green <see_websi  2008-05-11 12:00:34 
Re: JToggleButton event firing
Redbeard <tom.cowdery@  2008-05-08 04:27:53 
Re: JToggleButton event firing
Knute Johnson <nospam@  2008-05-08 08:43:16 
Re: JToggleButton event firing
Redbeard <tom.cowdery@  2008-05-10 20:46:56 
Re: JToggleButton event firing
"John B. Matthews&qu  2008-05-11 12:48:37 
Re: JToggleButton event firing
Redbeard <tom.cowdery@  2008-05-11 18:58:53 
Re: JToggleButton event firing
"John B. Matthews&qu  2008-05-12 08:42:27 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Jul 9 7:22:09 CDT 2008.