Talk About Network



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 > JToggleButton e...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 11 Topic 16060 of 16078
Post > Topic >>

JToggleButton event firing

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

It appears that the JToggleButton fires the event to change its state
when the button is released rather than when it is pressed.

I'm using the JToggleButton as a "card" in a Memory Card game since it
holds two images - one that shows when the button is unselected, and
the other when it is selected..  Unselected represents a card that is
face down, while selected is face up.

My concern is that if you hold the mouse button down but don't release
it until you are over a different button, you can see the "selected"
icon without truly selecting the button.  When the mouse exits the
button, it reverts back to the unselected image.  The associated
ActionEvent never fires.

Obviously, in a Memory Card game, that is considered a "cheat".  What
i want is to change the behavior so the button gets selected when the
button is pressed.

I've tried getModel().setPressed(boolean),
getModel().setRollover(boolean), getModel().setArmed(boolean), but
none of those do what I want.  Nor have I found any other method that
seems appropriate.

Any ideas?




 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 Thu May 15 0:16:39 CDT 2008.