public abstract class Box extends Gadget implements Styleable
Modifier and Type | Field and Description |
---|---|
static Style |
DEFAULT_STYLE |
protected Style |
style |
Modifier | Constructor and Description |
---|---|
protected |
Box() |
protected |
Box(Style style) |
Modifier and Type | Method and Description |
---|---|
static void |
drawBorder(Graphics g,
Style style,
int width,
int height) |
static void |
drawBox(Graphics g,
Style style,
int width,
int height) |
static void |
drawEmptyContent(Graphics g,
Style style,
int width,
int height) |
static void |
drawEmptyTextContent(Graphics g,
Style style,
int width,
int height) |
static void |
getContentSizeConstraints(Gadget gadget,
Style style,
Dimension constraints) |
static Dimension |
getEmptyContentSize(Gadget gadget,
Style style) |
static void |
getEmptyContentSize(Gadget gadget,
Style style,
Dimension size) |
int |
getMarginBottom()
Same as
Styled.getMarginTop() but for the bottom margin. |
int |
getMarginTop()
Returns the top margin of this object.
|
Style |
getStyle()
Returns the style of this object.
|
boolean |
hasDynamicVerticalMargins() |
void |
layout(int constrainedWidth,
int constrainedHeight,
boolean recursive)
Requests this gadget to relayout itself.
|
protected abstract void |
layoutContent(int constrainedWidth,
int constrainedHeight,
boolean recursive) |
void |
paint(Graphics g)
Paint this gadget using specified Graphics object.
|
protected abstract void |
paintContent(Graphics g) |
void |
setStyle(Style style) |
focusGained, focusLost, gadgetToPanel, gadgetToRoot, getAncestors, getBounds, getBounds, getCursor, getEventDispatcher, getFontMetrics, getGadgetPanel, getGraphics, getLocation, getLocation, getNonBreakableVerticalRanges, getRoot, getSize, getSize, getToolkit, getToolTip, grabsMouseButton, handleAppEvent, handleKeyEvent, handleMouseEvent, hasFocus, isAppEventHandler, layout, makeRectangleVisible, makeRectangleVisible, panelToGadget, print, refresh, relayout, relayout, repaint, repaint, requestFocus
protected Box()
protected Box(Style style)
public Style getStyle()
Styled
null
.public boolean hasDynamicVerticalMargins()
hasDynamicVerticalMargins
in interface Styled
public int getMarginTop()
Styled
Style.marginTop
,
the returned value is not a static one and may depend on the contents
of this object.
This method is needed to implement collapsed vertical margins in the case of nested boxes.
getMarginTop
in interface Styled
public int getMarginBottom()
Styled
Styled.getMarginTop()
but for the bottom margin.getMarginBottom
in interface Styled
public void layout(int constrainedWidth, int constrainedHeight, boolean recursive)
Gadget
This gadget responds by recomputing and updating its width and height.
layout
in class Gadget
constrainedWidth
- A stretchable gadget might be able to adapt its
size to this constrained width. A negative or null value means not
constrained.constrainedHeight
- A stretchable gadget might be able to adapt
its size to this constrained height. A negative or null value means not
constrained.recursive
- If true, recursively layout children too.protected abstract void layoutContent(int constrainedWidth, int constrainedHeight, boolean recursive)
public void paint(Graphics g)
Gadget
One cannot assume that any of the attributes of the Graphics object (background, foreground, font, etc) is properly set.
protected abstract void paintContent(Graphics g)
public static final void getContentSizeConstraints(Gadget gadget, Style style, Dimension constraints)
public static final void drawEmptyContent(Graphics g, Style style, int width, int height)
public static final void drawEmptyTextContent(Graphics g, Style style, int width, int height)