public class OrientedLabel extends ConfiguredBackgroundPanel
JPanel.AccessibleJPanel
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
OrientedLabel()
Creates a new label with no text
|
Modifier and Type | Method and Description |
---|---|
Color |
getBackground() |
FontModifier |
getFontModifier()
Gets the font modifier of this label.
|
Color |
getForeground() |
Icon |
getIcon()
Gets the icon of this label
|
int |
getIconOffset()
Gets the distance between icon and 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. |
Dimension |
getMinimumSize() |
Dimension |
getPreferredSize() |
String |
getText()
Gets the text of this label
|
boolean |
isHorizontal()
Tells whether the content of this label is painted horizontally.
|
boolean |
isIconHidden()
Tells whether the icon is not painted.
|
boolean |
isVertical()
Tells whether the content of this label is painted vertically.
|
void |
paint(Graphics g) |
void |
paintForeground(Graphics g)
Invokes the standard algorithm that paints the foreground
of the component.
|
void |
setBackground(Color bg) |
void |
setBounds(int x,
int y,
int w,
int h) |
void |
setEnabled(boolean enabled) |
void |
setFont(Font font) |
void |
setFontModifier(FontModifier modifier)
Sets the modifier for the current font.
|
void |
setForeground(Color fg) |
void |
setHorizontal(boolean horizontal)
Sets the orientation.
|
void |
setIcon(Icon icon)
Sets the icon which will be painted on the left or on the top side.
|
void |
setIconHidden(boolean hideIcon)
Tells whether the
icon is hidden. |
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(String text)
Sets the text of this label
|
void |
update(Graphics g) |
protected void |
updateFonts()
Called by
updateUI() if the fonts need to be
updated, the default implementation does nothing |
void |
updateUI() |
configure, setupRenderingHints
getBackgroundAlgorithm, getComponent, getTransparency, paintBackground, paintBorder, paintChildren, paintComponent, paintOverlay, setBackground, setTransparency
getAccessibleContext, getUI, getUIClassID, paramString, setUI
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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction
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, transferFocusDownCycle, validate, validateTree
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, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, 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, transferFocusBackward, transferFocusUpCycle
public void setIcon(Icon icon)
icon
- the icon, can be null
public Icon getIcon()
null
public void setIconOffset(int iconOffset)
iconOffset
- the distancepublic int getIconOffset()
public void setIconTextDistance(int iconTextDistance)
iconTextDistance
- the gappublic int getIconTextDistance()
public void setRotation(Rotation rotation)
rotation
- the orientation, not null
public void setHorizontal(boolean horizontal)
horizontal
, then the rotation is set
to 0 degrees, otherwise the rotation is set to 90 degrees.horizontal
- whether the label is painted horizontalpublic boolean isHorizontal()
public boolean isVertical()
public void setText(String text)
text
- the text, null
is allowedpublic String getText()
null
public void setEnabled(boolean enabled)
setEnabled
in class JComponent
public void setForeground(Color fg)
setForeground
in class JComponent
public Color getForeground()
getForeground
in class Component
public void setBackground(Color bg)
setBackground
in class JComponent
public Color getBackground()
getBackground
in class Component
public boolean isIconHidden()
setIconHidden(boolean)
public void setIconHidden(boolean hideIcon)
icon
is hidden. If the icon is hidden, it is not painted
and does not take any space. It is however treated normally when serving calls to getPreferredSize()
.hideIcon
- whether to hide the iconprotected void updateFonts()
updateUI()
if the fonts need to be
updated, the default implementation does nothingpublic void setFont(Font font)
setFont
in class JComponent
public void setFontModifier(FontModifier modifier)
modifier
- the modifierDLabel.setFontModifier(FontModifier)
public FontModifier getFontModifier()
public DLabel getLabel()
OrientedLabel
to paint its content. This method
should be treated with care, modifications to the underlying label may have unexpected side effects.public Dimension getMinimumSize()
getMinimumSize
in class JComponent
public Dimension getPreferredSize()
getPreferredSize
in class JComponent
public void paint(Graphics g)
paint
in class BackgroundPanel
public void paintForeground(Graphics g)
PaintableComponent
paintForeground
in interface PaintableComponent
paintForeground
in class BackgroundPanel
g
- the graphics context to use, null
to just inform
this component that the foreground should not be painted automaticallypublic void update(Graphics g)
update
in class JComponent