In article
<64bb689b-59ba-4f2a-8109-408cc671f0f6@[EMAIL PROTECTED]
>,
Redbeard <tom.cowdery@[EMAIL PROTECTED]
> wrote:
> On May 11, 11:48 am, "John B. Matthews" <nos...@[EMAIL PROTECTED]
> wrote:
> > In article
> > <cd26e5b0-3633-4c3f-934b-404d4edeb...@[EMAIL PROTECTED]
>,
> > Redbeard <tom.cowd...@[EMAIL PROTECTED]
> wrote:
> >
> > [...]
> >
> > I think it's the ToggleButtonModel that's responsible for the
behavior.
> > Why not instantiate JToggleButton and set the model to an extension of
> > DefaultButtonModel that overrides isArmed().
> >
> > [...]
>
> Sounds like an idea that is worth a try. Thanks!
Sorry, I misspoke: set the model to an extension of ToggleButtonModel
that overrides isArmed(). I think you still want the "toggle" behavior,
just not the "armed" behavior. Also note: the button model fires both
ActionEvent (for pressed) and ItemEvent (for both selected and
deselected), as part of the "group" notion for check boxes and radio
buttons.
It might be cleaner to extend AbstractButton and DefaultButtonModel to
create, in effect, a JConcentrationButton. The custom model could
enforce rules like "no peeking" and "exposing a third card flips the
other two," etc.
John
--
John B. Matthews
trashgod at gmail dot com
home dot woh dot rr dot com slash jbmatthews


|