Thanks for the answers.
I do aggree on all points. The problem is that I can't act on a
"per-listener" basis. I really need to get this to work for all JButtons by
subclassing the component...

Any idea ?
Thanks a lot.

Vincent.


----- Original Message -----
From: "Greg Munt" <[EMAIL PROTECTED]>
To: "Vincent Vandenschrick" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, June 06, 2001 4:34 PM
Subject: Re: Button multiple "fireActionPerformed"


> Why it won't work:
>
> 1. The two mouse clicks are two separate events
>
> 2. Event 1 calls your fireActionPerformed, which disables the button,
calls
> the real fireActionPerformed, then enables the button again.
>
> 3. Event 2 still causes things to happen, because the events are stored in
a
> queue, acted on in order.. So by the time the system comes to process
event
> 2, the last bit of event 1 has re-enabled the button.
>
> (Please correct me if I am inaccurate with that.)
>
> How it might work depends on what happens as a result of pressing the
> button. For example, say it shows a frame. Get your listener to detect
when
> the frame is opened and closed. Don't allow more frames to be opened if
> there is one open already.
>
>     -----Original Message-----
>     From: Vincent Vandenschrick <[EMAIL PROTECTED]>
>     To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>     Date: Wednesday, June 06, 2001 03:13
>     Subject: Button multiple "fireActionPerformed"
>
>
>     Hi list,
>
>     I appologize if the question has already been asked and answered. It
> seems to be very simple but I can't figure out how to do it.
>
>     I have a JButton with an action listener registered. The goal is to
> prevent a "multiple click" on the button to multiply the
> "fireActionPerformed".
>     My first idea was to override the fireActionPerformed method to first
> disable the button, really fireActionPerformed and then re-enable the
> button. This doesn't work since the multiple cliks seem to be forwarded to
> the eventDispatchThread before the button gets disabled.
>
>     Did any one ever solve this problem ?
>     Thanks for all your answers.
>
>     Vincent.
>
>
> _______________________________________________
> Swing mailing list
> [EMAIL PROTECTED]
> http://eos.dk/mailman/listinfo/swing
>

_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to