bibliothek.gui.dock.util.swing
Class OrientedLabel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by bibliothek.gui.dock.util.BackgroundPanel
                      extended by bibliothek.gui.dock.util.swing.OrientedLabel
All Implemented Interfaces:
PaintableComponent, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class OrientedLabel
extends BackgroundPanel

A label which draws some text, and can change the layout of the text between horizontal and vertical.

Author:
Benjamin Sigg
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
OrientedLabel()
          Creates a new label with no text
 
Method Summary
 FontModifier getFontModifier()
          Gets the font modifier of this label.
 javax.swing.Icon getIcon()
          Gets the icon of this label
 int getIconOffset()
          Gets the distance between icon the the tree adjacent borders.
 int getIconTextDistance()
          Gets the distance between icon and text.
 DLabel getLabel()
          Gets direct access to the label that is used by this OrientedLabel to paint its content.
 java.awt.Dimension getMinimumSize()
           
 java.awt.Dimension getPreferredSize()
           
 java.lang.String getText()
          Gets the text of this label
 boolean isHorizontal()
          Tells whether the content of this label is painted horizontally.
 boolean isVertical()
          Tells whether the content of this label is painted vertically.
 void paint(java.awt.Graphics g)
           
 void paintForeground(java.awt.Graphics g)
          Invokes the standard algorithm that paints the foreground of the component.
 void setBackground(java.awt.Color bg)
           
 void setBounds(int x, int y, int w, int h)
           
 void setFont(java.awt.Font font)
           
 void setFontModifier(FontModifier modifier)
          Sets the modifier for the current font.
 void setForeground(java.awt.Color fg)
           
 void setHorizontal(boolean horizontal)
          Sets the orientation.
 void setIcon(javax.swing.Icon icon)
          Sets the icon which will be painted on the left or on the top side.
 void setIconOffset(int iconOffset)
          Sets the distance between icon and the three adjacent borders.
 void setIconTextDistance(int iconTextDistance)
          Sets the distance between icon and text.
 void setRotation(Rotation rotation)
          Sets the orientation of this label.
 void setText(java.lang.String text)
          Sets the text of this label
 void update(java.awt.Graphics g)
           
protected  void updateFonts()
          Called by updateUI() if the fonts need to be updated, the default implementation does nothing
 void updateUI()
           
 
Methods inherited from class bibliothek.gui.dock.util.BackgroundPanel
getBackgroundAlgorithm, getComponent, isSolid, isTransparent, paintBackground, paintBorder, paintChildren, paintComponent, paintOverlay, setBackground, setSolid, setTransparent
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI
 
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, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, 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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction
 
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, imageUpdate, 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, 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
 

Constructor Detail

OrientedLabel

public OrientedLabel()
Creates a new label with no text

Method Detail

setIcon

public void setIcon(javax.swing.Icon icon)
Sets the icon which will be painted on the left or on the top side.

Parameters:
icon - the icon, can be null

getIcon

public javax.swing.Icon getIcon()
Gets the icon of this label

Returns:
the icon, can be null

setIconOffset

public void setIconOffset(int iconOffset)
Sets the distance between icon and the three adjacent borders.

Parameters:
iconOffset - the distance

getIconOffset

public int getIconOffset()
Gets the distance between icon the the tree adjacent borders.

Returns:
the distance

setIconTextDistance

public void setIconTextDistance(int iconTextDistance)
Sets the distance between icon and text.

Parameters:
iconTextDistance - the gap

getIconTextDistance

public int getIconTextDistance()
Gets the distance between icon and text.

Returns:
the gap

setRotation

public void setRotation(Rotation rotation)
Sets the orientation of this label.

Parameters:
rotation - the orientation, not null

setHorizontal

public void setHorizontal(boolean horizontal)
Sets the orientation. If horizontal, then the rotation is set to 0 degrees, otherwise the rotation is set to 90 degrees.

Parameters:
horizontal - whether the label is painted horizontal

isHorizontal

public boolean isHorizontal()
Tells whether the content of this label is painted horizontally.

Returns:
whether the label is horizontal

isVertical

public boolean isVertical()
Tells whether the content of this label is painted vertically.

Returns:
whether the label is vertical

setText

public void setText(java.lang.String text)
Sets the text of this label

Parameters:
text - the text, null is allowed

getText

public java.lang.String getText()
Gets the text of this label

Returns:
the text, may be null

setForeground

public void setForeground(java.awt.Color fg)
Overrides:
setForeground in class javax.swing.JComponent

setBackground

public void setBackground(java.awt.Color bg)
Overrides:
setBackground in class javax.swing.JComponent

updateUI

public void updateUI()
Overrides:
updateUI in class javax.swing.JPanel

updateFonts

protected void updateFonts()
Called by updateUI() if the fonts need to be updated, the default implementation does nothing


setFont

public void setFont(java.awt.Font font)
Overrides:
setFont in class javax.swing.JComponent

setFontModifier

public void setFontModifier(FontModifier modifier)
Sets the modifier for the current font.

Parameters:
modifier - the modifier
See Also:
DLabel.setFontModifier(FontModifier)

getFontModifier

public FontModifier getFontModifier()
Gets the font modifier of this label.

Returns:
the modifier

getLabel

public DLabel getLabel()
Gets direct access to the label that is used by this OrientedLabel to paint its content. This method should be treated with care, modifications to the underlying label may have unexpected side effects.

Returns:
the label that paints the content

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class javax.swing.JComponent

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

paint

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

paintForeground

public void paintForeground(java.awt.Graphics g)
Description copied from interface: PaintableComponent
Invokes the standard algorithm that paints the foreground of the component. This method should be called at most once.

Specified by:
paintForeground in interface PaintableComponent
Overrides:
paintForeground in class BackgroundPanel
Parameters:
g - the graphics context to use, null to just inform this component that the foreground should not be painted automatically

update

public void update(java.awt.Graphics g)
Overrides:
update in class javax.swing.JComponent

setBounds

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