org.jscience.awt.util
Class Border

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by org.jscience.awt.util.Border
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
Direct Known Subclasses:
EtchedBorder

public class Border
extends java.awt.Panel

A panel containing a single component, around which a border is drawn. Of course, the single component may be a container which may contain other components, so a Border can surround multiple components.

Thickness of the border, and the gap between the Component and the border are specified at time of construction. Default border thickness is 2 - default gap is 0.

Border color may be set via setLineColor(Color).

Border employs a DrawnRectangle to paint the border. Derived classes are free to override DrawnRectangle border() if they wish to use an extension of DrawnRectangle for drawing their border.

The following code snippet, from gjt.test.BorderTest creates an AWT Button, and embeds the button in a border. That border is then embedded in another border. The AWT Button winds up inside of a cyan border with a pixel width of 7, inside of a black border (pixel width 2):

      private Border makeBorderedAWTButton() {
          Button button;
          Border cyanBorder, blackBorder;
 

button = new Button("Button Inside Two Borders"); cyanBorder = new Border(button, 7); cyanBorder.setLineColor(Color.cyan);

blackBorder = new Border(cyanBorder);

return blackBorder; }

See Also:
DrawnRectangle, ThreeDBorder, EtchedBorder, gjt.test.BorderTest, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected static int _defaultGap
           
protected static int _defaultThickness
           
protected  DrawnRectangle border
           
protected  java.awt.Component borderMe
           
protected  int gap
           
protected  int thickness
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Border(java.awt.Component borderMe)
           
Border(java.awt.Component borderMe, int thickness)
           
Border(java.awt.Component borderMe, int thickness, int gap)
           
 
Method Summary
protected  DrawnRectangle border()
           
 java.awt.Component getComponent()
           
 java.awt.Rectangle getInnerBounds()
           
 java.awt.Insets getInsets()
           
 java.awt.Color getLineColor()
           
 java.awt.Insets insets()
          Deprecated. for JDK1.1
 void paint(java.awt.Graphics g)
           
protected  java.lang.String paramString()
           
 void reshape(int x, int y, int w, int h)
          Deprecated. for JDK1.1
 void resize(int w, int h)
          Deprecated. for JDK1.1
 void setBounds(int x, int y, int w, int h)
           
 void setLineColor(java.awt.Color c)
           
 void setSize(int w, int h)
           
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

thickness

protected int thickness

gap

protected int gap

border

protected DrawnRectangle border

borderMe

protected java.awt.Component borderMe

_defaultThickness

protected static int _defaultThickness

_defaultGap

protected static int _defaultGap
Constructor Detail

Border

public Border(java.awt.Component borderMe)

Border

public Border(java.awt.Component borderMe,
              int thickness)

Border

public Border(java.awt.Component borderMe,
              int thickness,
              int gap)
Method Detail

getComponent

public java.awt.Component getComponent()

getInnerBounds

public java.awt.Rectangle getInnerBounds()

setLineColor

public void setLineColor(java.awt.Color c)

getLineColor

public java.awt.Color getLineColor()

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Container

insets

public java.awt.Insets insets()
Deprecated. for JDK1.1

Overrides:
insets in class java.awt.Container

getInsets

public java.awt.Insets getInsets()
Overrides:
getInsets in class java.awt.Container

resize

public void resize(int w,
                   int h)
Deprecated. for JDK1.1

Overrides:
resize in class java.awt.Component

setSize

public void setSize(int w,
                    int h)
Overrides:
setSize in class java.awt.Component

reshape

public void reshape(int x,
                    int y,
                    int w,
                    int h)
Deprecated. for JDK1.1

Overrides:
reshape in class java.awt.Component

setBounds

public void setBounds(int x,
                      int y,
                      int w,
                      int h)
Overrides:
setBounds in class java.awt.Component

paramString

protected java.lang.String paramString()
Overrides:
paramString in class java.awt.Container

border

protected DrawnRectangle border()