Can someone guide me in the right direction to getting the action for the buttons down and also help me print the actions to the status area I have created?
package telephone;
import java.awt.*;
import java.awt.Graphics.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import java.util.*;
import java.awt.event.*;
import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;
/**
*
* @author A.N.T
*/
public class telephoneDesign implements ActionListener
{
/*
* Variables Used Throughout Project
*/
private JFrame telephone = new JFrame("Ant's Telephone");
private JPanel telephonepanel = new JPanel();
private JLabel printarea = new JLabel();
private JButton number0 = new JButton("0");
private JButton number1 = new JButton("1");
private JButton number2 = new JButton("2");
private JButton number3 = new JButton("3");
private JButton number4 = new JButton("4");
private JButton number5 = new JButton("5");
private JButton number6 = new JButton("6");
private JButton number7 = new JButton("7");
private JButton number8 = new JButton("8");
private JButton number9 = new JButton("9");
private JButton star = new JButton("*");
private JButton pound = new JButton("#");
private JButton call = new JButton("Call");
private JButton endcall = new JButton("End Call");
private JButton redial = new JButton("Redial");
/*
* Constructor that will design look.
*/
public telephoneDesign()
{
/*
* Creating the window for the project.
*/
telephone.setSize(300, 300);
telephone.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
telephonepanel.setLayout(new GridLayout(6,3));
telephone.add(telephonepanel);
/*
* Adds the numbers & other buttons to phone.
*/
telephonepanel.add(number1);
telephonepanel.add(number2);
telephonepanel.add(number3);
telephonepanel.add(number4);
telephonepanel.add(number5);
telephonepanel.add(number6);
telephonepanel.add(number7);
telephonepanel.add(number8);
telephonepanel.add(number9);
telephonepanel.add(star);
telephonepanel.add(number0);
telephonepanel.add(pound);
telephonepanel.add(call);
telephonepanel.add(redial);
telephonepanel.add(endcall);
/*
* For Status Area
*/
JPanel toparea = new JPanel();
telephone.add(toparea, BorderLayout.SOUTH);
JLabel status = new JLabel();
toparea.add(status, BorderLayout.CENTER);
telephone.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
throw new UnsupportedOperationException("Not supported yet.");
}
}
Edited by Alexander, 02 November 2010 - 08:27 PM.
Added [code] tags


Sign In
Create Account


Back to top









