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


|