Package jltk
Class ColoredPen
- java.lang.Object
-
- jltk.Pen
-
- jltk.ColoredPen
-
public class ColoredPen extends Pen
Beschreiben Sie hier die Klasse Coloredpen.- Version:
- 08.06.2022
- Author:
- ms
-
-
Field Summary
Fields Modifier and Type Field Description protected javafx.scene.paint.Paint
fillColor
protected boolean
fillEnabled
-
Constructor Summary
Constructors Constructor Description ColoredPen()
Creates a new colored pen on the last created.ColoredPen(Window pWindow)
Creates a new colored pen on the specified window.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disableFill()
Disable fill mode for this penvoid
drawCircle(double pRadius)
The colored pen draws a circle with the specified width and height.void
drawRect(double pWidth, double pHeight)
The colored pen draws a rectangle with the specified width and height.void
enableFill()
Enable fill mode for this penjavafx.scene.paint.Color
getFillColor()
Return the current fill color as Color object.javafx.scene.paint.Color
getLineColor()
Return the current line color as Color object.double
getTransparency()
boolean
isFillEnabled()
Return true, if the filling is enabled for this pen.void
setFillColor(double pRed, double pGreen, double pBlue)
The fillcolor of the component will be changed to specified rgb-colorvoid
setFillColor(String pColor)
The fill color of the pen will be changed to the specified color.void
setFillColor(javafx.scene.paint.Color pColor)
The fill color of the component will be changed to the specified colorvoid
setLineColor(double pRed, double pGreen, double pBlue)
The line color of the component will be changed to specified rgb-colorvoid
setLineColor(String pColor)
The line color of the pen will be changed.void
setLineColor(javafx.scene.paint.Color pColor)
The line color of the pen will be changed to specified colorvoid
setTransparency(double pValue)
-
Methods inherited from class jltk.Pen
delay, down, enableDrawMode, enableEraseMode, getFont, getFontSize, getRotation, getX, getY, isEraseModeEnabled, move, setDefault, setFont, setFontSize, setFontStyle, setPosition, setRotation, textHeight, textWidth, turn, turnTowards, up, write, write, write, write, write, write
-
-
-
-
Constructor Detail
-
ColoredPen
public ColoredPen()
Creates a new colored pen on the last created. Because of this, you first have to create a window and the a pen.
-
ColoredPen
public ColoredPen(Window pWindow)
Creates a new colored pen on the specified window.- Parameters:
pWindow
- The window for this pen.
-
-
Method Detail
-
drawRect
public void drawRect(double pWidth, double pHeight)
The colored pen draws a rectangle with the specified width and height. If fill is enabled (see enableFill()), the rectangle is filled with the fill color of this pen. The position of the pen is the upper left corner. The rectangle is also drawn when then pen is up.- Overrides:
drawRect
in classPen
- Parameters:
pWidth
- The width of the rectanglepHeight
- The height of the rectangle- See Also:
enableFill()
,#setFillColor()
-
drawCircle
public void drawCircle(double pRadius)
The colored pen draws a circle with the specified width and height. If fill is enabled (see enableFill()), the circle is filled with the fill color of this pen. The position of the pen is the center of the circle. The circle is also drawn when then pen is up.- Overrides:
drawCircle
in classPen
- Parameters:
pRadius
- The radius of the circle- See Also:
enableFill()
,#setFillColor()
-
enableFill
public void enableFill()
Enable fill mode for this pen
-
disableFill
public void disableFill()
Disable fill mode for this pen
-
isFillEnabled
public boolean isFillEnabled()
Return true, if the filling is enabled for this pen.- See Also:
enableFill()
,disableFill()
-
setLineColor
public void setLineColor(javafx.scene.paint.Color pColor)
The line color of the pen will be changed to specified color- Parameters:
pColor
- the new line color
-
setLineColor
public void setLineColor(double pRed, double pGreen, double pBlue)
The line 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)
-
setLineColor
public void setLineColor(String pColor)
The line color of the pen 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 setLineColor("ALICEBLUE") or setLineColor("blue").- Parameters:
pColor
- the new line color
-
getLineColor
public javafx.scene.paint.Color getLineColor()
Return the current line color as Color object.- Returns:
- The current line color.
-
setFillColor
public void setFillColor(double pRed, double pGreen, double pBlue)
The fillcolor 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)
-
setFillColor
public void setFillColor(String pColor)
The fill color of the pen will be changed to the specified color. 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 setFillColor("ALICEBLUE") or setFillColor("blue").- Parameters:
pColor
- the new fill color
-
getFillColor
public javafx.scene.paint.Color getFillColor()
Return the current fill color as Color object.- Returns:
- The current fill color.
-
setFillColor
public void setFillColor(javafx.scene.paint.Color pColor)
The fill color of the component will be changed to the specified color- Parameters:
pColor
- the new fill color
-
setTransparency
public void setTransparency(double pValue)
-
getTransparency
public double getTransparency()
-
-