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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!