com.isti.util.gui
Class SymbolJLabel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JLabel
                  extended by com.isti.util.gui.SymbolJLabel
All Implemented Interfaces:
SymbolConstants, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, javax.swing.SwingConstants

public class SymbolJLabel
extends javax.swing.JLabel
implements SymbolConstants

Class SymbolJLabel is a JLabel with a symbol to the left of its text. The symbol may be a filled circle, an empty circle, or a character; all with a given color.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JLabel
javax.swing.JLabel.AccessibleJLabel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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  boolean boldFlag
           
protected  java.awt.Color colorObj
           
protected static java.lang.String DEFAULT_SPACER_STRING
           
static int DEFAULT_SYMBOLSIZE
          Default symbol size value.
protected  boolean fillFlag
           
protected  java.lang.String labelText
           
protected  java.awt.Dimension originalDimension
           
protected  java.awt.Color outlineColorObj
           
protected  java.lang.String spacerString
           
protected static int SYMBOL_XPOS
           
protected static int symbolHeight
           
protected  int symbolObj
           
protected  int symbolSize
           
protected  java.lang.String symbolString
           
protected static int symbolWidth
           
protected  int symbolXOffsetVal
           
protected static java.awt.Font symFontBold
           
protected static java.awt.Font symFontPlain
           
protected static boolean symSetupFlag
           
 
Fields inherited from class javax.swing.JLabel
labelFor
 
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
 
Fields inherited from interface com.isti.util.gui.SymbolConstants
CIRCLE_SYMBOL_OBJECT, RECTANGLE_SYMBOL_OBJECT, TRIANGLE_SYMBOL_OBJECT
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SymbolJLabel(java.awt.Color colorObj, boolean fillFlag)
          Creates a label with a circle symbol and no text.
SymbolJLabel(java.awt.Color colorObj, char symbolChar, boolean boldFlag)
          Creates a label with a character symbol and no text.
SymbolJLabel(java.lang.String labelText, java.awt.Color colorObj, boolean fillFlag)
          Creates a label with a circle symbol.
SymbolJLabel(java.lang.String labelText, java.awt.Color colorObj, char symbolChar, boolean boldFlag)
          Creates a label with a character symbol.
 
Method Summary
 void clearSymbolChar()
          Clears any character symbol in use, making a circle symbol be used instead.
protected static java.awt.Polygon createTriangle(int x, int y, int width)
          Creates a triangle.
 java.lang.String getLabelText()
          Gets the text for the label (without the spacer string).
 java.lang.String getSpacerString()
          Gets the spacer string used to create space for the symbol.
 boolean isCharSymbol()
          Gets a flag indicating whether or not a character symbol is in use.
 void paint(java.awt.Graphics g)
          Calls the parent's paint method and then draws the symbol to the left of the text.
protected  void paintSymbol(java.awt.Graphics g, boolean fillFlag)
          Paints the symbol.
 void setBoldFlag(boolean flgVal)
          Sets whether or not the the character symbol is displayed using a bold font.
 void setColorObj(java.awt.Color colorObj)
          Sets the color for the symbol.
 void setFillFlag(boolean flgVal)
          Sets whether or not the the object symbol is filled.
 void setLabelText(java.lang.String str)
          Sets the text for the label.
 void setOutlineColorObj(java.awt.Color colorObj)
          Sets the outline color to be used for filled symbols.
 void setSpacerString(java.lang.String str)
          Sets the spacer string used to create space for the symbol.
 void setSymbolChar(char symbolChar)
          Sets the character symbol to be used.
 void setSymbolObject(int symbolObj)
          Sets the object symbol to be used.
 void setSymbolSize(int symbolSize)
          Sets the size for the symbol.
 void setSymbolXOffset(int offsetVal)
          Enters an X-axis offset for the symbol.
protected  java.lang.String symbolCharToString(char symbolChar)
          Converts the given symbol character to a displayable, single-character string.
protected  void updateComponent()
          Updates this component by calling 'revalidate()' and then 'repaint()'.
 
Methods inherited from class javax.swing.JLabel
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalAlignment, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setText, setUI, setVerticalAlignment, setVerticalTextPosition, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, 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

DEFAULT_SYMBOLSIZE

public static int DEFAULT_SYMBOLSIZE
Default symbol size value.


DEFAULT_SPACER_STRING

protected static final java.lang.String DEFAULT_SPACER_STRING
See Also:
Constant Field Values

SYMBOL_XPOS

protected static final int SYMBOL_XPOS
See Also:
Constant Field Values

symFontBold

protected static final java.awt.Font symFontBold

symFontPlain

protected static final java.awt.Font symFontPlain

spacerString

protected java.lang.String spacerString

labelText

protected java.lang.String labelText

colorObj

protected java.awt.Color colorObj

outlineColorObj

protected java.awt.Color outlineColorObj

fillFlag

protected boolean fillFlag

symbolString

protected java.lang.String symbolString

symbolObj

protected int symbolObj

boldFlag

protected boolean boldFlag

symbolHeight

protected static int symbolHeight

symbolWidth

protected static int symbolWidth

symSetupFlag

protected static boolean symSetupFlag

originalDimension

protected final java.awt.Dimension originalDimension

symbolSize

protected int symbolSize

symbolXOffsetVal

protected int symbolXOffsetVal
Constructor Detail

SymbolJLabel

public SymbolJLabel(java.lang.String labelText,
                    java.awt.Color colorObj,
                    boolean fillFlag)
Creates a label with a circle symbol.

Parameters:
labelText - the text for the label.
colorObj - the color for the symbol, or null for no symbol.
fillFlag - true if the circle is to be filled; false if not.

SymbolJLabel

public SymbolJLabel(java.awt.Color colorObj,
                    boolean fillFlag)
Creates a label with a circle symbol and no text.

Parameters:
colorObj - the color for the symbol, or null for no symbol.
fillFlag - true if the circle is to be filled; false if not.

SymbolJLabel

public SymbolJLabel(java.lang.String labelText,
                    java.awt.Color colorObj,
                    char symbolChar,
                    boolean boldFlag)
Creates a label with a character symbol.

Parameters:
labelText - the text for the label.
colorObj - the color for the symbol, or null for no symbol.
symbolChar - the character to be used.
boldFlag - true if the symbol character is to be displayed using a bold font; false if not.

SymbolJLabel

public SymbolJLabel(java.awt.Color colorObj,
                    char symbolChar,
                    boolean boldFlag)
Creates a label with a character symbol and no text.

Parameters:
colorObj - the color for the symbol, or null for no symbol.
symbolChar - the character to be used.
boldFlag - true if the symbol character is to be displayed using a bold font; false if not.
Method Detail

setLabelText

public void setLabelText(java.lang.String str)
Sets the text for the label. The spacer string is prepended.

Parameters:
str - the text string to use.

getLabelText

public java.lang.String getLabelText()
Gets the text for the label (without the spacer string).

Returns:
The text string for the label.

setSymbolSize

public void setSymbolSize(int symbolSize)
Sets the size for the symbol.

Parameters:
symbolSize - size of the symbol or DEFAULT_SYMBOLSIZE for default.

setSpacerString

public void setSpacerString(java.lang.String str)
Sets the spacer string used to create space for the symbol.

Parameters:
str - a string blanks for spacing.

getSpacerString

public java.lang.String getSpacerString()
Gets the spacer string used to create space for the symbol.

Returns:
the spacer string used to create space for the symbol.

setColorObj

public void setColorObj(java.awt.Color colorObj)
Sets the color for the symbol.

Parameters:
colorObj - the color to use.

setOutlineColorObj

public void setOutlineColorObj(java.awt.Color colorObj)
Sets the outline color to be used for filled symbols.

Parameters:
colorObj - the color for the symbol outline, or null for no outline.

setFillFlag

public void setFillFlag(boolean flgVal)
Sets whether or not the the object symbol is filled.

Parameters:
flgVal - true if the object is to be filled; false if not.

setSymbolChar

public void setSymbolChar(char symbolChar)
Sets the character symbol to be used.

Parameters:
symbolChar - the character symbol to use, or '(char)0' to have no character symbol (and use circle symbol instead).

setSymbolObject

public void setSymbolObject(int symbolObj)
Sets the object symbol to be used.

Parameters:
symbolObj - the object symbol to use.

updateComponent

protected void updateComponent()
Updates this component by calling 'revalidate()' and then 'repaint()'.


clearSymbolChar

public void clearSymbolChar()
Clears any character symbol in use, making a circle symbol be used instead.


setBoldFlag

public void setBoldFlag(boolean flgVal)
Sets whether or not the the character symbol is displayed using a bold font.

Parameters:
flgVal - true for bold, false for normal font.

setSymbolXOffset

public void setSymbolXOffset(int offsetVal)
Enters an X-axis offset for the symbol. This is used to enter a relative shift for the horizontal position of symbol.

Parameters:
offsetVal - the X-axis offset value to used, in pixels.

isCharSymbol

public boolean isCharSymbol()
Gets a flag indicating whether or not a character symbol is in use.

Returns:
true if a character symbol is in use, false if a object symbol is in use.

symbolCharToString

protected java.lang.String symbolCharToString(char symbolChar)
Converts the given symbol character to a displayable, single-character string.

Parameters:
symbolChar - the character to use.
Returns:
A new String.

paint

public void paint(java.awt.Graphics g)
Calls the parent's paint method and then draws the symbol to the left of the text.

Overrides:
paint in class javax.swing.JComponent
Parameters:
g - graphics object to use.

paintSymbol

protected void paintSymbol(java.awt.Graphics g,
                           boolean fillFlag)
Paints the symbol.

Parameters:
g - graphics object to use.
fillFlag - true if the circle is to be filled; false if not.

createTriangle

protected static java.awt.Polygon createTriangle(int x,
                                                 int y,
                                                 int width)
Creates a triangle.

Parameters:
x - the x coordinate of the triangle to be drawn.
y - the y coordinate of the triangle to be drawn.
width - the width of the triangle to be drawn.
Returns:
the triangle.