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 4 of 11 Topic 16060 of 16268
Post > Topic >>

Re: JToggleButton event firing

by Knute Johnson <nospam@[EMAIL PROTECTED] > May 7, 2008 at 10:17 PM

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.
> 
> 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?

Just write your own button.  This is really easy with a JPanel and a 
MouseListener.

-- 

Knute Johnson
email s/nospam/linux/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
      ------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
 




 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 Fri Jul 25 17:43:30 CDT 2008.