|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgui.AbstractSizer
public abstract class AbstractSizer
The AbstractSizer class is the base class for classes that manage resizing components such as text panes that can lay out their contents differently depending on available space.
The setWidth() and setHeight() methods are TemplateMethods in a Template Method design pattern, along with a private method that is invoked whenever the sized component is sized by a layout manager. Subclasses complete the implementation by implementing the primitive operation computePreferredSize().
An AbstractSizer variable may appear to be unused. This is because its methods are not always invoked directly. They may be only invoked through the ComponentListener that it installs on its component.
Constructor Summary | |
---|---|
AbstractSizer(javax.swing.JComponent c)
new AbstractSizer(c) returns a new sizer whosed sized component is c. |
Method Summary | |
---|---|
protected abstract java.awt.Dimension |
computePreferredSize(java.awt.Dimension sz)
computePreferredSize(sz) returns a preferred size based on the current actual size sz. |
void |
setHeight(int h)
s.setHeight(h) sets the initial heighth of the sized component of s to h. |
void |
setWidth(int w)
s.setWidth(w) sets the initial width of the sized component of s to w. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractSizer(javax.swing.JComponent c)
c
- the component to be sizedMethod Detail |
---|
protected abstract java.awt.Dimension computePreferredSize(java.awt.Dimension sz)
public void setWidth(int w)
w
- the initial widthpublic void setHeight(int h)
h
- the initial width
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |