... The user can type any characters in the input dialog’s text field. Our program assumes that the user enters a valid integer. If the user clicks Cancel, showInputDialog
returns null
. If the user either types a noninteger value or clicks the Cancel button in the input dialog, an exception will occur and the program will not operate correctly. Lines 12– 13 display another input dialog that prompts the user to enter the second integer. Each JOptionPane
dialog that you display is a so called modal dialog—while the dialog is on the screen, the user cannot interact with the rest of the application.
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.