[2157] in java-interest
Re: AWT instance variables
daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Tue Sep 26 08:45:24 1995
Date: Mon, 25 Sep 1995 09:46:41 -0800 (PDT)
From: Arthur van Hoff <Arthur.Vanhoff@Eng.Sun.COM>
Reply-To: Arthur van Hoff <Arthur.Vanhoff@Eng.Sun.COM>
To: Ed Grossman <egrossma@ncsa.uiuc.edu>
Cc: java-interest@java.Eng.Sun.COM
Hi Ed,
> Here is a list of things that I, as a class designer, might want a subclass
> of an AWT object to do, which cannot be done within the current framework
> unless the new objects are part of the AWT package.
>
> 1) As a descendant of Component, set my parent directly. In fact, even the
> "add" method of the Container object would not work if it were not in the
> same package as Component.
>
> 2) As a descendant of Menu, change the order of my Menu items, or choose to
> add a new item anyplace but the end of the menu.
>
> 3) As a descendant of Container, sort my children in place.
Any of these operations would break the AWT if you would do them by
directly accessing the instance variables. I'm glad we stopped you!
> 4) As a descendant of FlowLayout, change my alignment.
The fact that the layout objects have private variables is broken.
I'll fix that.
> I'm sure I could come up with more. Note that these are all things an
> object would want to do to itself, not things it would allow other objects
> to do. The way AWT is written, subclasses as a rule do not have any more
> privileged access to their ancestors' instance variables (which could
> really be thought of as their own instance variables) than any other class,
> thus making AWT extremely difficult to extend.
I disagree. It makes the AWT safer.
> I'd like to know if this state of affairs is going to continue in future
> releases.
Absolutely!
Have fun,
Arthur van Hoff
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com