JavaFX Label

javafx.scene.control.Label class represents label control. As the name suggests, the label is the component that is used to place any text information on the screen. It is mainly used to describe the purpose of the other components to the user. You can not set a focus on the label using the Tab key.

Package: javafx.scene.control

Constructors:

Adding a Node to the scene graph

The following code implements Label into our Application.

Output:


JavaFX Label

Displaying image in a Label

JavaFX allows us to display some graphics next to the label text. There is a constructor in the Label class in which, we can pass any image along with the label text. The example given below is displaying the image in a Label.

Output:


JavaFX Label 2
Next TopicJavaFX Button




Contact US

Email:[email protected]

JavaFX Label
10/30