import java.lang.*; import java.awt.*; import java.awt.event.*; class VirtualKey extends Frame implements ActionListener { Button B1 = new Button("A"); Button B2 = new Button("B"); Button B3 = new Button("C"); Button B4 = new Button("D"); Button B5 = new Button("E"); Button B6 = new Button("F"); Button B7 = new Button("G"); Button B8 = new Button("H"); Button B9 = new Button("I"); Button B10 = new Button("J"); Button B11 = new Button("K"); Button B12 = new Button("L"); Button B13 = new Button("M"); Button B14 = new Button("N"); Button B15 = new Button("O"); Button B16 = new Button("P"); Button B17 = new Button("Q"); Button B18 = new Button("R"); Button B19 = new Button("S"); Button B20 = new Button("T"); Button B21 = new Button("U"); Button B22 = new Button("V"); Button B23 = new Button("W"); Button B24 = new Button("X"); Button B25 = new Button("Y"); Button B26 = new Button("Z"); VirtualKey() { FlowLayout f = new FlowLayout(0); setLayout(f); setSize(500, 500); add(B1); add(B2); add(B3); add(B4); add(B5); add(B6); add(B7); add(B8); add(B9); add(B10); add(B11); add(B12); add(B13); add(B14); add(B15); add(B16); add(B17); add(B18); add(B19); add(B20); add(B21); add(B22); add(B23); add(B24); add(B25); add(B26); B1.addActionListener(this); B2.addActionListener(this); B3.addActionListener(this); B4.addActionListener(this); B5.addActionListener(this); B6.addActionListener(this); B7.addActionListener(this); B8.addActionListener(this); B9.addActionListener(this); B10.addActionListener(this); B11.addActionListener(this); B12.addActionListener(this); B13.addActionListener(this); B14.addActionListener(this); B15.addActionListener(this); B16.addActionListener(this); B17.addActionListener(this); B18.addActionListener(this); B19.addActionListener(this); B20.addActionListener(this); B21.addActionListener(this); B22.addActionListener(this); B23.addActionListener(this); B24.addActionListener(this); B25.addActionListener(this); B26.addActionListener(this); setVisible(true); } public void actionPerformed(ActionEvent ae) { System.out.println("Action Performed" + ae.getSource().toString()); if (ae.getSource().equals(B1)) { System.out.println("B1 Button Call"); } if (ae.getSource().equals(B2)) { System.out.println("B2 Button Call"); } } public static void main(String args[]) { VirtualKey VK = new VirtualKey(); } }