ListItemWidgetpublic class LabelWidget extends Widget
It allows to set 4 types of horizontal and vertical alignments (by default LEFT as horizontal and BASELINE as vertical).
Swing Font-hinting feature may cause the labels are not rendered completely.
Using setUseGlyphVector you may force the label to be converted to a glyph vector
which scales correctly for any zoom factor.
| Modifier and Type | Class | Description |
|---|---|---|
static class |
LabelWidget.Alignment |
The text alignment
|
static class |
LabelWidget.Orientation |
The text orientation
|
static class |
LabelWidget.VerticalAlignment |
The text vertical alignment
|
Widget.Dependency| Constructor | Description |
|---|---|
LabelWidget(Scene scene) |
Creates a label widget.
|
LabelWidget(Scene scene,
java.lang.String label) |
Creates a label widget with a label.
|
| Modifier and Type | Method | Description |
|---|---|---|
protected java.awt.Rectangle |
calculateClientArea() |
Calculates a client area for the label.
|
LabelWidget.Alignment |
getAlignment() |
Returns a text horizontal alignment.
|
java.lang.String |
getLabel() |
Returns a label.
|
LabelWidget.Orientation |
getOrientation() |
Gets a text orientation.
|
LabelWidget.VerticalAlignment |
getVerticalAlignment() |
Gets a text vertical alignment.
|
boolean |
isPaintAsDisabled() |
Returns whether the label is painted as disabled.
|
boolean |
isUseGlyphVector() |
Returns whether the label widget is using glyph vector for rendering text.
|
protected void |
paintWidget() |
Paints the label widget.
|
void |
setAlignment(LabelWidget.Alignment alignment) |
Sets a text horizontal alignment.
|
void |
setLabel(java.lang.String label) |
Sets a label.
|
void |
setOrientation(LabelWidget.Orientation orientation) |
Sets a text orientation.
|
void |
setPaintAsDisabled(boolean paintAsDisabled) |
Sets whether the label is painted as disabled.
|
void |
setUseGlyphVector(boolean useGlyphVector) |
Sets whether the label widget is using glyph vector for rendering text.
|
void |
setVerticalAlignment(LabelWidget.VerticalAlignment verticalAlignment) |
Sets a text vertical alignment.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitaddChild, addChild, addChild, addChild, addChildren, addDependency, bringToBack, bringToFront, convertLocalToScene, convertLocalToScene, convertSceneToLocal, convertSceneToLocal, createActions, equals, getAccessibleContext, getActions, getActions, getBackground, getBorder, getBounds, getChildConstraint, getChildren, getClientArea, getCursor, getCursorAt, getDependencies, getFont, getForeground, getGraphics, getLayout, getLocation, getLookup, getMaximumSize, getMinimumSize, getParentWidget, getPreferredBounds, getPreferredLocation, getPreferredSize, getResourceTable, getScene, getState, getToolTipText, hashCode, isCheckClipping, isEnabled, isHitAt, isOpaque, isPreferredBoundsSet, isRepaintRequiredForRevalidating, isValidated, isVisible, notifyAdded, notifyBackgroundChanged, notifyFontChanged, notifyForegroundChanged, notifyRemoved, notifyStateChanged, paint, paintBackground, paintBorder, paintChildren, removeChild, removeChildren, removeChildren, removeDependency, removeFromParent, repaint, resolveBounds, revalidate, revalidate, setAccessibleContext, setBackground, setBackgroundFromResource, setBorder, setBorder, setCheckClipping, setChildConstraint, setCursor, setEnabled, setFont, setFontFromResource, setForeground, setForegroundFromResource, setLayout, setMaximumSize, setMinimumSize, setOpaque, setPreferredBounds, setPreferredLocation, setPreferredSize, setResourceTable, setState, setToolTipText, setVisible, updateResourcespublic LabelWidget(Scene scene)
scene - the scenepublic LabelWidget(Scene scene, java.lang.String label)
scene - the scenelabel - the labelpublic java.lang.String getLabel()
public void setLabel(java.lang.String label)
label - the labelpublic LabelWidget.Alignment getAlignment()
public void setAlignment(LabelWidget.Alignment alignment)
alignment - the text horizontal alignmentpublic LabelWidget.VerticalAlignment getVerticalAlignment()
public void setVerticalAlignment(LabelWidget.VerticalAlignment verticalAlignment)
verticalAlignment - the text vertical alignmentpublic LabelWidget.Orientation getOrientation()
public void setOrientation(LabelWidget.Orientation orientation)
orientation - the text orientationpublic boolean isPaintAsDisabled()
public void setPaintAsDisabled(boolean paintAsDisabled)
paintAsDisabled - if true, then the label is painted as disabledpublic boolean isUseGlyphVector()
public void setUseGlyphVector(boolean useGlyphVector)
Note that using glyph vector could slow-down the rendering performance. Note that if you are not using glyph vector then the text may be clipped when a scene has zoom factor different from 1.0.
useGlyphVector - if true, then a glyph vector is used for rendering textprotected java.awt.Rectangle calculateClientArea()
calculateClientArea in class Widgetprotected void paintWidget()
paintWidget in class WidgetBuilt on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.