Exercises
12.3 (Running the Welcome App) In Section12.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 Section12.5.4 —to load and displayWelcome.fxml
in a JavaFX window.12.1 (Addition App) Create a JavaFX version of the addition program in Fig.2.7 . Use two
TextField
s to receive the user’s input and aButton
to initiate the calculation. Display the results in aLabel
. SinceTextField
methodgetText
returns aString
, you must convert theString
the user enters to anint
for use in calculations. Recall that thestatic
methodparseInt
of classInteger
takes aString
argument representing an integer and returns the value as anint
.
Get Java How to Program, Early 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.