Exercises

  1. 12.3 (Running the Welcome App) In Section 12.4, you built the Welcome app’s GUI and previewed it using Scene Builder’s Show Preview in Window option. Create an Application subclass— like the one shown in Section 12.5.4—to load and display Welcome.fxml in a JavaFX window.

  2. 12.1 (Addition App) Create a JavaFX version of the addition program in Fig. 2.7. Use two Text-Fields to receive the user’s input and a Button to initiate the calculation. Display the results in a Label. Since TextField method getText returns a String, you must convert the String the user enters to an int for use in calculations. Recall that the static method parseInt of class Integer takes a String argument representing an integer and returns the value as an int

Get Java How To Program, Late Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.