25.5.5 TipCalculatorController Class

Figures 25.1825.21 present the TipCalculatorController class that responds to user interactions with the app’s Button and Slider. Replace the code that NetBeans generated in TipCalculatorController.java with the code in Figs. 25.1825.21.

Class TipCalculatorController’s import Statements

Figure 25.18 shows class TipCalculatorController’s import statements.

 1   // TipCalculatorController.jav 2   // Controller that handles calculateButton and tipPercentageSlider events 3   import java.math.BigDecimal; 4   import java.math.RoundingMode; 5   import java.text.NumberFormat; 6   import javafx.beans.value.ChangeListener; 7   import javafx.beans.value.ObservableValue; 8   import ...

Get Java™ How To Program (Early Objects), Tenth 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.