FontPosture class is a part of JavaFX. FontPosture class specifies whether a font is REGULAR or ITALIC. FontPosture class inherits Enum class.
Commonly Used Methods:
|findByName(String n)||Returns FontPosture by its name.|
|valueOf(String n)||Returns a FontPosture with the specified name.|
|values()||returns an array with all the elements of the FontPosture type.|
Java Program to create a font object and set a specified posture and apply it to a text: In this program we will create two Text object and set one’s font posture to REGULAR and the other one to ITALIC. Then set the text to the TextFlow and add this textflow to the VBox and add the vbox to the scene, and add the scene to the stage. Also, set the line spacing and text alignment of the textflow and the spacing of the vbox. Call the show() function to display the final results.
Note: The above programs might not run in an online IDE please use an offline compiler.
- JavaFX | Tab Class
- JavaFX | Pos Class
- JavaFX | TextFlow Class
- JavaFX | Font Class
- JavaFX | DirectoryChooser Class
- JavaFX | StackPane Class
- JavaFX | FontWeight Class
- JavaFX | TextAlignment Class
- JavaFX | FileChooser Class
- JavaFX | Duration Class
- JavaFX | CycleMethod Class
- JavaFX | ColorInput Class
- JavaFX | InnerShadow Class
- JavaFX | ImagePattern Class
- JavaFX | HTMLEditor Class
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.