dog.gui
Class DLabel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--dog.gui.DComponent
              |
              +--dog.gui.DLabel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, Referential, java.io.Serializable

public class DLabel
extends DComponent

A multiline label component.

The label can be aligned centrally, against any edge, or against any vertex of its bounds.

See Also:
Serialized Form

Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
protected  int align
          The label alignment.
protected  java.lang.String label
          The label text.
 
Fields inherited from class dog.gui.DComponent
CENTER, CENTER_TILE, changes, EAST, INTEGER_TILE, MAXIMIZE, MAXIMIZE_ASPECT, MAXIMIZE_HORIZONTAL, MAXIMIZE_VERTICAL, NORTH, NORTHEAST, NORTHWEST, reference, SOUTH, SOUTHEAST, SOUTHWEST, TILE, tooltip, WEST
 
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
DLabel()
          Constructs a label with the text "New label", aligned to the west.
DLabel(java.lang.String label)
          Constructs a label with the specified text, aligned to the west.
DLabel(java.lang.String label, int align)
          Constructs a label with the specified text and alignment.
 
Method Summary
 int getAlign()
          Returns the alignment of this label.
 java.lang.String getLabel()
          Returns the text of this label.
 java.awt.Dimension getMinimumSize()
          Returns the minimum size for this label.
 java.awt.Dimension getPreferredSize()
          Returns the preferred size for this label.
 java.lang.String getText()
          Returns the text of this label.
 void paint(java.awt.Graphics g)
          Paints this label.
 java.lang.String paramString()
          Returns the parameter string for this label.
 void setAlign(int align)
          Sets the alignment of this label.
 void setLabel(java.lang.String label)
          Sets the text of this label.
 void setText(java.lang.String label)
          Sets the text of this label.
 void update(java.awt.Graphics g)
          Updates the graphics context for this label.
 
Methods inherited from class dog.gui.DComponent
addPropertyChangeListener, alignParamString, drawActiveButtonBorder, drawActiveOptionBorder, drawArrow, drawBackgroundImage, drawBorder, drawButtonBorder, drawCheckbox, drawDarkBorder, drawDefaultButtonBorder, drawDisabledBorder, drawDisabledCheckbox, drawDisabledOption, drawExpander, drawFocusBorder, drawImage, drawLabel, drawOption, drawOptionBorder, drawPressedBorder, drawTick, getDefaultToolkit, getImage, getImage, getImage, getReference, getRootPane, getRows, getTooltip, isPreloadImages, parseColor, parseFont, processCancelAction, processDefaultAction, processEvent, processMouseEvent, processMouseMotionEvent, removePropertyChangeListener, setEnabled, setPreloadImages, setReference, setTooltip, toString
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

label

protected java.lang.String label
The label text.

align

protected int align
The label alignment.
Constructor Detail

DLabel

public DLabel()
Constructs a label with the text "New label", aligned to the west.

DLabel

public DLabel(java.lang.String label)
Constructs a label with the specified text, aligned to the west.

DLabel

public DLabel(java.lang.String label,
              int align)
Constructs a label with the specified text and alignment.
Method Detail

getText

public java.lang.String getText()
Returns the text of this label. This is an alias for getLabel().
See Also:
getLabel()

setText

public void setText(java.lang.String label)
Sets the text of this label. This is an alias for setLabel().
See Also:
setLabel(java.lang.String)

getLabel

public java.lang.String getLabel()
Returns the text of this label.
See Also:
setLabel(java.lang.String)

setLabel

public void setLabel(java.lang.String label)
Sets the text of this label.
See Also:
getLabel()

getAlign

public int getAlign()
Returns the alignment of this label.
See Also:
setAlign(int)

setAlign

public void setAlign(int align)
Sets the alignment of this label.
Parameters:
align - one of CENTER, NORTH, EAST, SOUTH, WEST, NORTHEAST, SOUTHEAST, SOUTHWEST, or NORTHWEST.
See Also:
getAlign()

getMinimumSize

public java.awt.Dimension getMinimumSize()
Returns the minimum size for this label. The minimum size is calculated as the length of the longest word by the font height.
Overrides:
getMinimumSize in class java.awt.Component

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the preferred size for this label. The minimum size is calculated as the length of the longest line by the font height times the number of lines.
Overrides:
getPreferredSize in class java.awt.Component

update

public void update(java.awt.Graphics g)
Updates the graphics context for this label.
Overrides:
update in class java.awt.Component

paint

public void paint(java.awt.Graphics g)
Paints this label.
Overrides:
paint in class java.awt.Component

paramString

public java.lang.String paramString()
Returns the parameter string for this label.
Overrides:
paramString in class DComponent