|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLabel
org.formaria.swing.Label
public class Label
Draws text. The text may be wrapped over multiple lines.
Copyright (c) Formaria Ltd.,
License: see license.txt
| 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 |
antiAlias
|
protected TextRenderer |
renderer
The renderer that will paint the component |
| 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 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 | |
|---|---|
Label()
|
|
| Method Summary | |
|---|---|
void |
addNotify()
Repaint the component once it has been created |
int |
getAlignment()
Get the horizontal alignment style constant, the function is same to getHorizontalAlignment() |
boolean |
getAntiAlias()
Gets the antialias property of the text. |
int |
getHorizontalAlignment()
Get the horizontal alignment style constant |
java.awt.Dimension |
getPreferredScrollableViewportSize()
Returns the preferred size of the viewport for a view component. |
java.awt.Dimension |
getPreferredSize()
Gets the preferred size of this component. |
int |
getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Components that display logical rows or columns should compute the scroll increment that will completely expose one block of rows or columns, depending on the value of orientation. |
boolean |
getScrollableTracksViewportHeight()
Return true if a viewport should always force the height of this Scrollable to match the height of the viewport. |
boolean |
getScrollableTracksViewportWidth()
Return true if a viewport should always force the width of this Scrollable to match the width of the viewport. |
int |
getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Components that display logical rows or columns should compute the scroll increment that will completely expose one new row or column, depending on the value of orientation. |
int |
getVerticalAlignment()
Get the vertical alignment style constant |
void |
paintComponent(java.awt.Graphics g)
Render the text |
void |
setAlign(int align)
Deprecated. use setAlignment instead |
void |
setAlignment(int align)
Set one or more attributes of the component. |
void |
setAlignment(java.lang.String value)
Set one or more attributes of the component. |
void |
setAntiAlias(boolean b)
Sets the antialias property of the text. |
void |
setBuffered(boolean buffer)
Set the double buffering |
void |
setHorizontalAlignment(int align)
Set one or more attributes of the component. |
void |
setText(java.lang.String value)
Set the text |
void |
setTransparent(boolean b)
Sets the transparency of the text. |
void |
setUseRenderer(boolean state)
Set the renderering to the TextRenderer |
void |
setVerticalAlignment(int align)
Set one or more attributes of the component. |
void |
setVerticalAlignment(java.lang.String value)
Set the vertical alignment |
void |
update(java.awt.Graphics g)
Update the component |
| Methods inherited from class javax.swing.JLabel |
|---|
checkHorizontalKey, checkVerticalKey, getAccessibleContext, getDisabledIcon, getDisplayedMnemonic, getDisplayedMnemonicIndex, getHorizontalTextPosition, getIcon, getIconTextGap, getLabelFor, getText, getUI, getUIClassID, getVerticalTextPosition, imageUpdate, paramString, setDisabledIcon, setDisplayedMnemonic, setDisplayedMnemonic, setDisplayedMnemonicIndex, setHorizontalTextPosition, setIcon, setIconTextGap, setLabelFor, setUI, setVerticalTextPosition, updateUI |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, 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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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 |
| 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 |
| Methods inherited from interface org.formaria.aria.TextHolder |
|---|
getText |
| Field Detail |
|---|
protected TextRenderer renderer
protected boolean antiAlias
| Constructor Detail |
|---|
public Label()
| Method Detail |
|---|
public void update(java.awt.Graphics g)
update in class javax.swing.JComponentg - the graphcis contextpublic void addNotify()
addNotify in class javax.swing.JComponentpublic void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentg - the graphcis contextpublic int getAlignment()
public void setAlignment(int align)
align - 1 to right align the text, 0 for left alignment and 2 for centered textpublic void setAlign(int align)
align - 1 to right align the text, 0 for left alignment and 2 for centered textpublic void setAlignment(java.lang.String value)
align - 1 to right align the text, 0 for left alignment and 2 for centered textpublic int getHorizontalAlignment()
getHorizontalAlignment in class javax.swing.JLabelpublic void setHorizontalAlignment(int align)
setHorizontalAlignment in class javax.swing.JLabelalign - 1 to right align the text, 0 for left alignment and 2 for centered textpublic int getVerticalAlignment()
getVerticalAlignment in class javax.swing.JLabelpublic void setVerticalAlignment(int align)
setVerticalAlignment in class javax.swing.JLabelalign - 1 to right align the text, 0 for left alignment and 2 for centered textpublic void setTransparent(boolean b)
b - true to make text transparentpublic void setAntiAlias(boolean b)
b - true if text is antialiasedpublic boolean getAntiAlias()
public void setBuffered(boolean buffer)
buffer - public void setVerticalAlignment(java.lang.String value)
value - top, bottom, centerpublic void setUseRenderer(boolean state)
public void setText(java.lang.String value)
setText in interface TextHoldersetText in class javax.swing.JLabelvalue - public java.awt.Dimension getPreferredSize()
getPreferredSize in class javax.swing.JComponentJComponent.getMinimumSize(),
LayoutManagerpublic java.awt.Dimension getPreferredScrollableViewportSize()
JList component
is the size required to accommodate all of the cells in its list.
However, the value of preferredScrollableViewportSize
is the size required for JList.getVisibleRowCount rows.
A component without any properties that would affect the viewport
size should just return getPreferredSize here.
getPreferredScrollableViewportSize in interface javax.swing.ScrollableJViewport whose view
is this ScrollableJComponent.getPreferredSize()
public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Scrolling containers, like JScrollPane, will use this method each time the user requests a unit scroll.
getScrollableUnitIncrement in interface javax.swing.ScrollablevisibleRect - The view area visible within the viewportorientation - Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.direction - Less than zero to scroll up/left, greater than zero for down/right.
JScrollBar.setUnitIncrement(int)
public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
int orientation,
int direction)
Scrolling containers, like JScrollPane, will use this method each time the user requests a block scroll.
getScrollableBlockIncrement in interface javax.swing.ScrollablevisibleRect - The view area visible within the viewportorientation - Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.direction - Less than zero to scroll up/left, greater than zero for down/right.
JScrollBar.setBlockIncrement(int)public boolean getScrollableTracksViewportWidth()
Scrollable to match the width of the viewport.
For example a normal
text view that supported line wrapping would return true here, since it
would be undesirable for wrapped lines to disappear beyond the right
edge of the viewport. Note that returning true for a Scrollable
whose ancestor is a JScrollPane effectively disables horizontal
scrolling.
Scrolling containers, like JViewport, will use this method each time they are validated.
getScrollableTracksViewportWidth in interface javax.swing.Scrollablepublic boolean getScrollableTracksViewportHeight()
Scrolling containers, like JViewport, will use this method each time they are validated.
getScrollableTracksViewportHeight in interface javax.swing.Scrollable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||