When your application requires text on the screen, we can use the JavaFX Text class. Since Text inherits from the Node class, we can also apply special effects, animation and transformations to text nodes. Remember, it is also possible to style your text using CSS. Let’s start by adding text to the page and then changing the font and fill color with CSS. To make the text centered horizontally and vertically, we can use the hbox and vbox ui layouts.
- [Voiceover] When you're designing your user interface,…a lot of times, you'll need to put text…at certain areas on the screen.…We can use the JavaFX Text Class to help us out.…The JavaFX Text class inherits directly from the Node class.…This is important, because this allows us…to apply special effects, animation,…and transformations to our text.…Remember, it is also possible to style your text…using cascading style sheet, or CSS.…Let's take a look at a net themes project.…
We'll start by adding text to the page…and then changing the font and fill color using CSS.…I'm going to start a new project,…and I'm going to call it add text with style.…Okay, for this page, what I'd like to do is…have some text across the top,…maybe like a banner,…also, text on the left and right hand sides,…text in the center, and text in the bottom,…almost like a footer.…To make the text centered horizontally and vertically,…we can use our H box and V box UI layout,…and then add them to the boarder pane layout.…
To keep the code in the main part of my program simple,…
- What is JavaFX?
- Creating a simple JavaFX program
- Drawing lines, shapes, and text
- Applying effects
- Adding and animating images and charts
- Customizing interfaces with CSS
Skill Level Intermediate
1. Get Started with JavaFX
2. Sample Applications
4. User Interface Components
6. Custom UIs
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.