Package jltk.gui
Class Labeled
- java.lang.Object
-
- jltk.Component
-
- jltk.gui.Control
-
- jltk.gui.Labeled
-
- Direct Known Subclasses:
Button
,CheckBox
,Label
,RadioButton
public abstract class Labeled extends Control
Abstract class Labled - A class for all components having a label (Button, Checkbox, Label)- Version:
- 13.05.2022
- Author:
- ms
-
-
Field Summary
Fields Modifier and Type Field Description protected javafx.scene.text.Font
font
(package private) javafx.scene.control.Labeled
fxLabledComponent
-
Fields inherited from class jltk.Component
fxNode, hasFocus, myWindow, onFocusGained, onFocusLost
-
-
Constructor Summary
Constructors Constructor Description Labeled()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getFont()
Returns the name of the font family (also see setFont()).double
getFontSize()
Returns the font size.String
getText()
Returns the text of the labled component.protected void
init(double pLeft, double pTop, double pWidth, double pHeight, Window pWindow, javafx.scene.control.Labeled pComponent)
boolean
isUnderline()
Returns wether the component is underline or not.void
setFont(String pFontName)
Sets the font family, as parameter you can use e.g.void
setFontColor(double pRed, double pGreen, double pBlue)
The font color of the component will be changed to specified rgb-colorvoid
setFontColor(String pColor)
The font color of the component will be changed.void
setFontColor(javafx.scene.paint.Color pColor)
The font color of the component will be changed to specified colorvoid
setFontSize(double pSize)
Sets the size of the textvoid
setFontStyle(boolean pBold, boolean pItalic)
Set the font style of this labled component.void
setText(String pText)
Set the text of the labled component.void
setTextAlignment(String pAlignment)
Aligns the text to the specified positionvoid
setUnderline(boolean pUnderline)
If the parameter ist true, the text of this component will be underline.-
Methods inherited from class jltk.gui.Control
getColor, getHeight, getWidth, init, setColor, setColor, setColor, setHeight, setSize, setTooltip, setWidth
-
Methods inherited from class jltk.Component
activate, deactivate, focus, getX, getY, hasFocus, hide, init, istActive, isVisible, runMethodByName, setOnFocusGained, setOnFocusLost, setPosition, show, toBack, toFront
-
-
-
-
Method Detail
-
init
protected void init(double pLeft, double pTop, double pWidth, double pHeight, Window pWindow, javafx.scene.control.Labeled pComponent)
-
setText
public void setText(String pText)
Set the text of the labled component.- Parameters:
pText
-
-
getText
public String getText()
Returns the text of the labled component.- Returns:
-
setUnderline
public void setUnderline(boolean pUnderline)
If the parameter ist true, the text of this component will be underline.- Parameters:
pUnderline
- true if text should be underline, false if not.
-
isUnderline
public boolean isUnderline()
Returns wether the component is underline or not.- Returns:
-
setFontStyle
public void setFontStyle(boolean pBold, boolean pItalic)
Set the font style of this labled component.- Parameters:
pBold
- true if bold, else falsepItalic
- true if italic, else false
-
setFont
public void setFont(String pFontName)
Sets the font family, as parameter you can use e.g. Verdana, Helvetica, Times New Roman, Comic Sans MS, Impact, Lucida Sans Unicode. You can print all available fonts of your system, if you run jltk.util.Misc.printAvailableFontNames().- Parameters:
pFont
- The font family
-
getFont
public String getFont()
Returns the name of the font family (also see setFont()).- Returns:
- The font family
-
setFontSize
public void setFontSize(double pSize)
Sets the size of the text- Parameters:
pSize
- The font size
-
getFontSize
public double getFontSize()
Returns the font size.- Returns:
- the font size.
-
setFontColor
public void setFontColor(double pRed, double pGreen, double pBlue)
The font color of the component will be changed to specified rgb-color- Parameters:
pRed
- the red proportion (must be between 0 and 1)pGreen
- the green proportion (must be between 0 and 1)pBlue
- the blue proportion (must be between 0 and 1)
-
setFontColor
public void setFontColor(javafx.scene.paint.Color pColor)
The font color of the component will be changed to specified color- Parameters:
The
- new font color
-
setFontColor
public void setFontColor(String pColor)
The font color of the component will be changed. As Parameter you can use the color name from the javafx.scene.paint.Color field https://docs.oracle.com/javase/8/javafx/api/javafx/scene/paint/Color.html#field.summary For example setFontColor("ALICEBLUE") or setFontColor("blue").- Parameters:
pColor
- the new font color
-
setTextAlignment
public void setTextAlignment(String pAlignment)
Aligns the text to the specified position- Parameters:
pAlignment
- Alignment can be left, center, right
-
-