Chapter 3

Setting the Stage and Scene Layout


check Looking at some useful methods of the Stage and Scene classes

check Alternating scenes within a single stage

check Displaying alert boxes

check Discovering the proper way to exit a JavaFX program

O for a Muse of fire, that would ascendThe brightest heaven of Invention,

A kingdom for a stage, princes to act,And monarchs to behold the swelling scene!

So begins William Shakespeare’s play Henry V, and so also begins this chapter, in which I explore the various ways to manipulate the appearance of a JavaFX application by manipulating its stage and its swelling scenes.

Specifically, this chapter introduces you to important details about the Stage class and the Scene class so that you can control such things as whether the window is resizable and if so, whether it has a maximum or a minimum size. You also learn how to coerce your programs into displaying additional stages beyond the primary stage, such as an alert or confirmation dialog box. And finally, you learn the proper way to end a JavaFX program by handling the events generated when the ...

Get Java All-in-One For Dummies, 5th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.