Question: 8. Write an application that models a telephone keypad. Use a JPanel panel to hold twelve buttons1, 2, 3, 4, 5, 6, 7, 8, 9,
8. Write an application that models a telephone keypad. Use a JPanel panel to hold twelve buttons1, 2, 3, 4, 5, 6, 7, 8, 9, *, 0, # in the center of a grid layout. Place a blank label in the south location. As each number is pressed, append that digit to the text of the label.
The first number in the number cannot be 0. If the user types 0 as the first number, do nothing with it.
Format the number using dashes, as follows:
1-000-000-0000 if the first digit entered is a 1.
(000) 000-0000 if ten digits are entered.
000-0000 if seven digits are entered.
Do not accept extra digits.
Instructions 1. Name your java program TelephoneKeypad.java.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
