Package com.jogamp.graph.ui.shapes
Class Label
- java.lang.Object
-
- com.jogamp.graph.ui.Shape
-
- com.jogamp.graph.ui.GraphShape
-
- com.jogamp.graph.ui.shapes.Label
-
public class Label extends GraphShape
A GraphUI text labelGraphShape
GraphUI is GPU based and resolution independent.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.jogamp.graph.ui.Shape
Shape.EventInfo, Shape.Listener, Shape.ListenerBool, Shape.MouseGestureAdapter, Shape.MouseGestureListener, Shape.Visitor1, Shape.Visitor2
-
-
Field Summary
-
Fields inherited from class com.jogamp.graph.ui.Shape
ZAscendingComparator
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Font
getFont()
Return theFont
used to render the textfloat
getFontScale()
Gets the font-scale factor, by which the em-sized type glyphs shall be scaled.float
getLineHeight()
ReturnsFont.getLineHeight()
*getFontScale()
.float
getScaledLineHeight()
String
getSubString()
String
getText()
Return the text to be rendered.boolean
setFont(Font font)
Set theFont
used to render the textboolean
setFontScale(float fontScale)
Sets the font-scale factor, by which the em-sized type glyphs shall be scaled.boolean
setText(GL2ES2 gl, String text)
Set the text to be rendered and immediately updates the shape if necessary.boolean
setText(GLProfile glp, String text)
Set the text to be rendered and immediately updates the shape if necessary.boolean
setText(String text)
Set the text to be rendered.-
Methods inherited from class com.jogamp.graph.ui.GraphShape
getQuality, getRenderModes, getSharpness, hasColorChannel, setQuality, setSharpness, setTextureUnit
-
Methods inherited from class com.jogamp.graph.ui.Shape
addMouseListener, clear, destroy, draw, drawToSelect, getBorderColor, getBorderThickness, getBounds, getBounds, getColor, getName, getPadding, getPixelPerShapeUnit, getPixelPerShapeUnit, getPosition, getRotation, getRotationPivot, getScale, getScaledHeight, getScaledWidth, getSurfacePort, getSurfaceSize, getSurfaceSize, getSurfaceSize, hasBorder, hasPadding, isDraggable, isEnabled, isInteractive, isPressed, isResizable, isToggleable, isToggleOn, markShapeDirty, markStateDirty, move, move, moveTo, moveTo, onClicked, onInit, onMove, onToggle, removeMouseListener, scale, setBorder, setBorderColor, setBorderColor, setColor, setColor, setDragAndResizeable, setDraggable, setEnabled, setInteractive, setName, setPaddding, setPressed, setPressedColorMod, setResizable, setRotationPivot, setRotationPivot, setScale, setToggle, setToggleable, setToggleOffColorMod, setToggleOnColorMod, setTransform, shapeToWinCoord, shapeToWinCoord, shapeToWinCoord, toggle, toString, validate, validate, winToShapeCoord, winToShapeCoord, winToShapeCoord
-
-
-
-
Constructor Detail
-
Label
public Label(int renderModes, Font font, float fontScale, String text)
Label ctor using a separatefontScale
to scale the em-sized type glyphs- Parameters:
renderModes
- region renderModesfont
- the fontfontScale
- font-scale factor, by which the em-sized type glyphs shall be scaledtext
- the text to render
-
-
Method Detail
-
getText
public String getText()
Return the text to be rendered.
-
setText
public boolean setText(String text)
Set the text to be rendered. Shape update is pending until nextShape.draw(GL2ES2, RegionRenderer, int[])
orShape.validate(GL2ES2)
.- Parameters:
text
- the text to be set.- Returns:
- true if text has been updated, false if unchanged.
-
setText
public boolean setText(GL2ES2 gl, String text)
Set the text to be rendered and immediately updates the shape if necessary.- Parameters:
gl
-GL2ES2
to issueShape.validate(GL2ES2)
in case text changed to immediately update shape andShape.getBounds()
text
- the text to be set.- Returns:
- true if text has been updated, false if unchanged.
-
setText
public boolean setText(GLProfile glp, String text)
Set the text to be rendered and immediately updates the shape if necessary.- Parameters:
glp
-GLProfile
to issueShape.validate(GLProfile)
in case text changed to immediately update shape andShape.getBounds()
text
- the text to be set.- Returns:
- true if text has been updated, false if unchanged.
-
setFont
public boolean setFont(Font font)
Set theFont
used to render the text- Parameters:
font
- the font to be set.- Returns:
- true if font has been updated, false if unchanged.
-
getFontScale
public float getFontScale()
Gets the font-scale factor, by which the em-sized type glyphs shall be scaled.
-
getLineHeight
public float getLineHeight()
ReturnsFont.getLineHeight()
*getFontScale()
.
-
getScaledLineHeight
public float getScaledLineHeight()
-
setFontScale
public boolean setFontScale(float fontScale)
Sets the font-scale factor, by which the em-sized type glyphs shall be scaled.This will lead to a recreate the shape's region in case fontScale differs.
Use
Shape.scale(float, float, float)
for non-expensive shape scaling.- Parameters:
fontScale
- font-scale factor, by which the em-sized type glyphs shall be scaled- Returns:
- true if font-scale has been updated, false if unchanged.
-
getSubString
public String getSubString()
- Overrides:
getSubString
in classShape
-
-