Package jltk.gui
Class Image
- java.lang.Object
-
- jltk.Component
-
- jltk.gui.Control
-
- jltk.gui.Image
-
public class Image extends Control
A object of this class is used to show an image.- Version:
- 18.8.2022
- Author:
- ms
-
-
Field Summary
Fields Modifier and Type Field Description protected javafx.scene.image.Image
fxImage
protected javafx.scene.image.ImageView
fxImageView
protected javafx.scene.control.Label
fxLabel
-
Fields inherited from class jltk.Component
fxNode, hasFocus, myWindow, onFocusGained, onFocusLost
-
-
Constructor Summary
Constructors Constructor Description Image(double pLeft, double pTop, double pWidth, double pHeight, String pFile)
Loads the image from the specified file.Image(double pLeft, double pTop, double pWidth, String pFile)
Loads the image from the specified file.Image(Window pWindow, double pLeft, double pTop, double pWidth, double pHeight, String pFile)
Loads the image from a file.Image(Window pWindow, double pLeft, double pTop, double pWidth, String pFile)
Loads the image from the specified file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
setImage(String pFile)
Set a new image and scale it to the width an height of the old imagevoid
setOnImageClicked(String pMethodName)
Set the name of the method, which will be invoked, if the image is clicked.-
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
-
-
-
-
Constructor Detail
-
Image
public Image(double pLeft, double pTop, double pWidth, double pHeight, String pFile)
Loads the image from the specified file. The image is scaled to the specified width and height.- Parameters:
pLeft
- The horizontal coordinatepTop
- The vertical coordinatepWidth
- The width of the labelpHeight
- The height of the imagepImage
- The filename of the image.
-
Image
public Image(double pLeft, double pTop, double pWidth, String pFile)
Loads the image from the specified file. The image is scaled to the specified width. The height is scaled to preserve ratio.- Parameters:
pLeft
- The horizontal coordinatepTop
- The vertical coordinatepWidth
- The width of the labelpImage
- The filename of the image.
-
Image
public Image(Window pWindow, double pLeft, double pTop, double pWidth, String pFile)
Loads the image from the specified file. The image is scaled to the specified width. The height is scaled to preserve ratio. The image is placed on the specified window.- Parameters:
pWindow
- The window, the image should be placepLeft
- The horizontal coordinatepTop
- The vertical coordinatepWidth
- The width of the labelpImage
- The filename of the image.
-
Image
public Image(Window pWindow, double pLeft, double pTop, double pWidth, double pHeight, String pFile)
Loads the image from a file. The image is scaled to the specified width and height and placed on the specified window- Parameters:
pWindow
- The window, the image should be placedpLeft
- The horizontal coordinatepTop
- The vertical coordinatepWidth
- The width of the labelpHeight
- The height of the imagepImage
- The filename of the image.
-
-
Method Detail
-
setImage
public void setImage(String pFile)
Set a new image and scale it to the width an height of the old image- Parameters:
pFile
- The filename of the new image.
-
setOnImageClicked
public void setOnImageClicked(String pMethodName)
Set the name of the method, which will be invoked, if the image is clicked.
-
-