import javax.swing.*; import java.awt.*; import java.awt.Graphics; import java.awt.event.*; public class phonepad extends JFrame implements ActionListener { // declare constants and variables for the entire window private int gap = 30; private int W = 60; // width of textfield // declare gui elements private JButton convertbutton; private JTextField[] A; // constructor: public phonepad(int size) { int i = 0; // loop counter // create gui elements convertbutton = new JButton("convert"); A = new JTextField[size]; while (i=97 && a<=122) a=a-32; if (a<65 || a>90) return c; if (a<=(int)'C') return '2'; if (a<=(int)'F') return '3'; if (a<=(int)'I') return '4'; if (a<=(int)'L') return '5'; if (a<=(int)'O') return '6'; if (a<=(int)'S') return '7'; if (a<=(int)'V') return '8'; else return '9'; } // convert1 public static void main(String[] args) { phonepad app = new phonepad(8); app.setVisible(true); app.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); } // main } // phonepad