buoy.widget
Class BOutline

java.lang.Object
  extended by buoy.event.EventSource
      extended by buoy.widget.Widget
          extended by buoy.widget.WidgetContainer
              extended by buoy.widget.BOutline

public class BOutline
extends WidgetContainer

A BOutline is a WidgetContainer that draws an outline around another Widget. The appearance of the outline is determined by a javax.swing.border.Border object. There are static methods for creating several common types of outlines, or you can use a different type by providing your own Border object.

Author:
Peter Eastman

Constructor Summary
BOutline()
          Create a new BOutline with no content Widget and no border.
BOutline(Widget content, javax.swing.border.Border border)
          Create a new BOutline.
 
Method Summary
static BOutline createBevelBorder(Widget content, boolean raised)
          Create a BOutline with a beveled border.
static BOutline createEmptyBorder(Widget content, int thickness)
          Create a BOutline with an empty border.
static BOutline createEtchedBorder(Widget content, boolean raised)
          Create a BOutline with an etched border.
static BOutline createLineBorder(Widget content, java.awt.Color color, int thickness)
          Create a BOutline with a line border.
 javax.swing.border.Border getBorder()
          Get the Border object which draws this Widget's outline.
 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.awt.Dimension getMaximumSize()
          Get the largest size at which this Widget can reasonably be drawn.
 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 the content Widget from this container.
 void setBorder(javax.swing.border.Border border)
          Set the Border object which draws this Widget's outline.
 void setContent(Widget contentWidget)
          Set the content Widget.
 
Methods inherited from class buoy.widget.WidgetContainer
isOpaque, setOpaque
 
Methods inherited from class buoy.widget.Widget
addEventLink, dispatchEvent, getBackground, getBounds, getComponent, getCursor, getFont, getName, getParent, hasFocus, isEnabled, isFocusable, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setName, setVisible
 
Methods inherited from class buoy.event.EventSource
addEventLink, addEventLink, removeEventLink
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BOutline

public BOutline()
Create a new BOutline with no content Widget and no border.


BOutline

public BOutline(Widget content,
                javax.swing.border.Border border)
Create a new BOutline.

Parameters:
content - the Widget to use as the content of the BOutline
border - the outline to draw around the content Widget
Method Detail

createEmptyBorder

public static BOutline createEmptyBorder(Widget content,
                                         int thickness)
Create a BOutline with an empty border.

Parameters:
content - the Widget to use as the content of the BOutline
thickness - the thickness of the border

createEtchedBorder

public static BOutline createEtchedBorder(Widget content,
                                          boolean raised)
Create a BOutline with an etched border.

Parameters:
content - the Widget to use as the content of the BOutline
raised - if true, the border will have a raised appearance. If false, it will have a lowered appearance.

createBevelBorder

public static BOutline createBevelBorder(Widget content,
                                         boolean raised)
Create a BOutline with a beveled border.

Parameters:
content - the Widget to use as the content of the BOutline
raised - if true, the border will have a raised appearance. If false, it will have a lowered appearance.

createLineBorder

public static BOutline createLineBorder(Widget content,
                                        java.awt.Color color,
                                        int thickness)
Create a BOutline with a line border.

Parameters:
content - the Widget to use as the content of the BOutline
color - the color of the border
thickness - the thickness of the border

getBorder

public javax.swing.border.Border getBorder()
Get the Border object which draws this Widget's outline.


setBorder

public void setBorder(javax.swing.border.Border border)
Set the Border object which draws this Widget's outline.


getContent

public Widget getContent()
Get the content Widget.


setContent

public void setContent(Widget contentWidget)
Set the content Widget.


getChildCount

public int getChildCount()
Get the number of children in this container.

Specified by:
getChildCount in class WidgetContainer

getChildren

public java.util.Collection<Widget> getChildren()
Get a Collection containing all child Widgets of this container.

Specified by:
getChildren in class WidgetContainer

remove

public void remove(Widget widget)
Remove a child Widget from this container.

Specified by:
remove in class WidgetContainer

removeAll

public void removeAll()
Remove the content Widget from this container.

Specified by:
removeAll in class WidgetContainer

layoutChildren

public void layoutChildren()
Layout the child Widgets. This may be invoked whenever something has changed (the size of this WidgetContainer, the preferred size of one of its children, etc.) that causes the layout to no longer be correct. If a child is itself a WidgetContainer, its layoutChildren() method will be called in turn.

Specified by:
layoutChildren in class WidgetContainer

getMinimumSize

public java.awt.Dimension getMinimumSize()
Get the smallest size at which this Widget can reasonably be drawn. When a WidgetContainer lays out its contents, it will attempt never to make this Widget smaller than its minimum size.

Overrides:
getMinimumSize in class Widget

getMaximumSize

public java.awt.Dimension getMaximumSize()
Get the largest size at which this Widget can reasonably be drawn. When a WidgetContainer lays out its contents, it will attempt never to make this Widget larger than its maximum size.

Overrides:
getMaximumSize in class Widget

getPreferredSize

public java.awt.Dimension getPreferredSize()
Get the preferred size at which this Widget will look best. When a WidgetContainer lays out its contents, it will attempt to make this Widget as close as possible to its preferred size.

Overrides:
getPreferredSize in class Widget


Written by Peter Eastman.