uk.co.ist.mwt
Class Separator

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--uk.co.ist.mwt.ShadowedComponent
                          |
                          +--uk.co.ist.mwt.Separator

public class Separator
extends ShadowedComponent

The Separator is a horizontal or vertical line for separating objects in a display. It mimicks the Motif XmSeparator.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Field Summary
static int kDoubleDashedLine
          Constant to specify that the separator should be two simple dashed lines.
static int kDoubleLine
          Constant to specify that the separator should be two simple lines.
static int kNoLine
          Constant to specify that the separator should have no visible appearance - that it should be blank.
static int kShadowEtchedIn
          Constant to specify that the separator should be an etched in line.
static int kShadowEtchedInDash
          Constant to specify that the separator should be a dashed etched in line.
static int kShadowEtchedOut
          Constant to specify that the separator should be an etched out line.
static int kShadowEtchedOutDash
          Constant to specify that the separator should be a dashed etched out line.
static int kSingleDashedLine
          Constant to specify that the separator should be a simple dashed line.
static int kSingleLine
          Constant to specify that the separator should be a simple line.
 
Fields inherited from class uk.co.ist.mwt.ShadowedComponent
shadowDrawer
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
Separator()
          Creates an etched-in horizontal separator with no margins
Separator(boolean vertical)
          Creates an etched in separator with no margins.
Separator(int margin)
          Creates an etched-in horizontal separator.
Separator(int margin, boolean vertical, int type)
          Creates a separator
 
Method Summary
 void drawLine(java.awt.Graphics g, int startX, int startY, int endX, int endY)
          Draws the separator's line in a particular Graphics object
 int getMargin()
          Gets the space left above and below the separator's line(s) (to the sides if vertical)
 java.awt.Dimension getMinimumSize()
          Finds the smallest size the separator can be
 java.awt.Dimension getPreferredSize()
          Finds the size the separator wants to be
 int getType()
          Gets the type of the separtor.
 boolean isVertical()
          Gets whether the separator is vertical or not
 void paintComponent(java.awt.Graphics g)
          Calculates the area where the separator should be drawn, and calls drawLine to do the work
 void setMargin(int margin)
          Sets the space to leave above and below the separator's line(s) (to the sides if vertical)
 void setType(int type)
          Sets the type of the separtor.
 void setVertical(boolean val)
          Sets whether the separator is vertical or not
 
Methods inherited from class uk.co.ist.mwt.ShadowedComponent
draw3DRect, draw3DRect, draw3DRect, draw3DRect, drawShadow, drawShadow, getBottomShadowColor, getShadowThickness, getTopShadowColor, setBottomShadowColor, setShadowThickness, setTopShadowColor
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

kSingleLine

public static final int kSingleLine
Constant to specify that the separator should be a simple line.

kDoubleLine

public static final int kDoubleLine
Constant to specify that the separator should be two simple lines. NB. Not implemented.

kSingleDashedLine

public static final int kSingleDashedLine
Constant to specify that the separator should be a simple dashed line. NB. Not implemented.

kDoubleDashedLine

public static final int kDoubleDashedLine
Constant to specify that the separator should be two simple dashed lines. NB. Not implemented.

kNoLine

public static final int kNoLine
Constant to specify that the separator should have no visible appearance - that it should be blank.

kShadowEtchedIn

public static final int kShadowEtchedIn
Constant to specify that the separator should be an etched in line.

kShadowEtchedOut

public static final int kShadowEtchedOut
Constant to specify that the separator should be an etched out line.

kShadowEtchedInDash

public static final int kShadowEtchedInDash
Constant to specify that the separator should be a dashed etched in line. NB. Not implemented.

kShadowEtchedOutDash

public static final int kShadowEtchedOutDash
Constant to specify that the separator should be a dashed etched out line. NB. Not implemented.
Constructor Detail

Separator

public Separator(int margin,
                 boolean vertical,
                 int type)
Creates a separator
Parameters:
margin - the space to leave above and below the separator's line(s) (to the sides if vertical)
vertical - should the separator be vertical?
type - one of the constant separator-type specifiers

Separator

public Separator(boolean vertical)
Creates an etched in separator with no margins.
Parameters:
vertical - should the separator be vertical?

Separator

public Separator(int margin)
Creates an etched-in horizontal separator.
Parameters:
margin - the space to leave above and below the separator's line(s)

Separator

public Separator()
Creates an etched-in horizontal separator with no margins
Method Detail

setMargin

public void setMargin(int margin)
Sets the space to leave above and below the separator's line(s) (to the sides if vertical)

getMargin

public int getMargin()
Gets the space left above and below the separator's line(s) (to the sides if vertical)

setType

public void setType(int type)
Sets the type of the separtor.

getType

public int getType()
Gets the type of the separtor.

setVertical

public void setVertical(boolean val)
Sets whether the separator is vertical or not

isVertical

public boolean isVertical()
Gets whether the separator is vertical or not

paintComponent

public void paintComponent(java.awt.Graphics g)
Calculates the area where the separator should be drawn, and calls drawLine to do the work
Overrides:
paintComponent in class javax.swing.JComponent
See Also:
drawLine(java.awt.Graphics, int, int, int, int)

drawLine

public void drawLine(java.awt.Graphics g,
                     int startX,
                     int startY,
                     int endX,
                     int endY)
Draws the separator's line in a particular Graphics object
Parameters:
g - the Graphics object
startX - the X co-ordinate to start from
startY - the Y co-ordinate to start from
endX - the X co-ordinate to end
endY - the Y co-ordinate to end
See Also:
JComponent.paint(java.awt.Graphics)

getPreferredSize

public java.awt.Dimension getPreferredSize()
Finds the size the separator wants to be
Overrides:
getPreferredSize in class javax.swing.JComponent

getMinimumSize

public java.awt.Dimension getMinimumSize()
Finds the smallest size the separator can be
Overrides:
getMinimumSize in class javax.swing.JComponent