Java Reference
In-Depth Information
Consider copying an
OzTextArea
object. When you investigate this class, you see that it is
a subclass of
JPanel
, as Figure 18.2 shows.
Figure 18.2. The
OzTextArea
class inherits a large number of methods and variables
from its superclasses.
Subclassing from
JPanel
lets
OzTextArea
objects uniformly wrap their contents in a
scrolling panel and a standard border. This makes text panels in the GUI more appealing, but
it also has the effect of giving
OzTextArea
objects a huge number of instance variables,
including those that
OzTextArea
declares and all those that
OzTextArea
inherits from its
superclasses.
A GUI object can easily have more than 100 instance variables. These attributes often include
dependencies on other objects and on operating system resources that you cannot safely copy