JavaFX provides a set of 2D class objects that can be used to draw lines and shapes similar to the way we could draw in Swing. Here is a sample scene that I created by adding lines and shapes, using the fill and stroke properties to add color. This scene contains lines, a circle, and a rectangle with a blue background to represent a seesaw at a playground.
- [Voiceover] The JavaFX API…provides a set of two D-class objects…that can be used to draw lines and shapes,…similar to the way we can draw in Swing.…Here is a sample scene that I created…by adding lines and shapes…using the fill and stroke properties to add color.…As you can see, it's a very simple scene…with a sky-blue background, two shapes,…a circle and a rectangle,…a line for my seesaw that has a very thick stroke,…and then two legs.…Here is a quick tip…on creating scenes in Java Effects…or any GUI application for that matter.…
When I want to draw a scene in Java,…I usually get some graph paper…and sketch it out first.…This helps to easily identify…the correct XY coordinates…and other variables for the size of your shapes.…Remember, the XY coordinate system…in a Java window starts at 00…in the upper left hand corner…and the values of X and Y increase…as X goes across horizontally…and Y goes down vertically.…Here is the sketch that I used…to create the playground.…
I placed my seesaw first,…identifying the points for the beginning…
- 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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.