[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] fixes to swing button implementation
From: |
Michael Koch |
Subject: |
Re: [PATCH] fixes to swing button implementation |
Date: |
Tue, 6 Jan 2004 22:27:25 +0100 |
User-agent: |
Mutt/1.3.28i |
On Tue, Jan 06, 2004 at 10:17:04PM +0100, Sascha Brawer wrote:
> graydon hoare <address@hidden> wrote on Tue, 6 Jan 2004 15:05:53 -0500:
>
> >+ // ChangeEvents are not AWTEvents, can't use multicaster
> >+ Vector changeListeners = new Vector ();
>
> Using Vector means a lot of synchronization operations.
> java.util.ArrayList/LinkedList are not synchronized, which makes their
> usage more efficient. But probably, it would best tp use
> javax.swing.event.EventListenerList here (which, by coincidence, became
> functional this afternoon...). See the Javadoc in Classpath for how to
> use it efficiently. Or, for a more concrete example of its use, have a
> look at the method javax.swing.DefaultBoundedRangeModel.fireStateChanged.
>
> A general stylistic question: foo ().bar (baz) or foo().bar(baz)?
>
> AbstractButton.getMargin(): I'm not sure whether or not it should return
> a clone of the internal Insets object... A simple Mauve testcase could
> check for this.
>
> >Index: javax/swing/DefaultButtonModel.java
> >===================================================================
> >+ ActionListener actionListener;
> >+ ItemListener itemListener;
> >+
> >+ // ChangeEvents are not AWTEvents
> >+ Vector changeListeners = new Vector ();
>
> See above: it probably would be advisable to use
> javax.swing.event.EventListenerList instead of Vector.
The EventListenerList stuff is already on my disc since some time for
most JContainer subclasses. I said graydon not to do it.
Michael