25.5 Tip Calculator App—Introduction to Event Handling

The Tip Calculator app (Fig. 25.9(a)) calculates and displays a restaurant bill tip and total. By default, the app calculates the total with a 15% tip. You can specify a tip percentage from 0% to 30% by moving the Slider thumb—this updates the tip percentage (Fig. 25.9(b) and (c)). In this section, you’ll build a Tip Calculator app using several JavaFX components and learn how to respond to user interactions with the GUI.

Image

a) Initial Tip Calculator GUI

Image

b) GUI after user enters the amount ...

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.