public class DockableWidget extends WidgetContainer
DockingContainer
, and rearranged by the user. It is a
container which holds a single content Widget and draws a border around it. By clicking on the
border, the user can drag the DockableWidget to any other DockingContainer in the same window,
group the Widgets in a DockingContainer into tabs, and reorder the Widgets within a tab.
The border drawn by this class consists of a fairly simple title bar. You can change the appearance
of the border by creating a subclass and overriding getBorderInsets()
,
paintBorder(java.awt.Graphics2D)
, and isInDragRegion(java.awt.Point)
.
Constructor and Description |
---|
DockableWidget()
Create a DockableWidget with no content Widget or label.
|
DockableWidget(Widget content,
java.lang.String label)
Create a DockableWidget.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Rectangle |
getBounds()
Get the current location and size of this Widget.
|
int |
getChildCount()
Get the number of children in this container.
|
java.util.Collection<Widget> |
getChildren()
Get a Collection containing all child Widgets of this container.
|
Widget |
getContent()
Get the content Widget.
|
java.lang.String |
getLabel()
Get the label which appears in the title bar.
|
java.awt.Dimension |
getMinimumSize()
Get the smallest size at which this Widget can reasonably be drawn.
|
java.awt.Dimension |
getPreferredSize()
Get the preferred size at which this Widget will look best.
|
void |
layoutChildren()
Layout the child Widgets.
|
void |
remove(Widget widget)
Remove a child Widget from this container.
|
void |
removeAll()
Remove all child Widgets from this container.
|
void |
setContent(Widget widget)
Set the content Widget.
|
void |
setLabel(java.lang.String label)
Set the label which appears in the title bar.
|
isOpaque, setOpaque
addEventLink, dispatchEvent, getBackground, getComponent, getCursor, getFont, getMaximumSize, getName, getParent, hasFocus, isEnabled, isFocusable, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setName, setVisible
addEventLink, addEventLink, removeEventLink
public DockableWidget()
public DockableWidget(Widget content, java.lang.String label)
content
- the content Widgetlabel
- the label to appear in the title barpublic Widget getContent()
public void setContent(Widget widget)
public java.lang.String getLabel()
public void setLabel(java.lang.String label)
public java.awt.Dimension getPreferredSize()
Widget
getPreferredSize
in class Widget
public java.awt.Dimension getMinimumSize()
Widget
getMinimumSize
in class Widget
public int getChildCount()
WidgetContainer
getChildCount
in class WidgetContainer
public java.util.Collection<Widget> getChildren()
WidgetContainer
getChildren
in class WidgetContainer
public void remove(Widget widget)
WidgetContainer
remove
in class WidgetContainer
public void removeAll()
WidgetContainer
removeAll
in class WidgetContainer
public void layoutChildren()
WidgetContainer
layoutChildren
in class WidgetContainer
Written by Peter Eastman.