This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fixes to swing button implementation


On Tue, Jan 06, 2004 at 10:17:04PM +0100, Sascha Brawer wrote:
> graydon hoare <graydon@redhat.com> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]