import java.awt.*;
public class CalInter extends JApplet{
//declare and initialise objects
private JButton aButton[] = new JButton[16];
private String aString[] = {"7","8","9","/","4","5","6","*","1","2","3","-","0",".","=","+"};
private BorderLayout aBorder = new BorderLayout();
private GridLayout aGrid = new GridLayout(4,4);
//declare objects
private JPanel aPane;
private JTextField aTextField;
public void init()
{
//CalInter aCalInter = new aCalInter();
//initialise Panel
aPane = new JPanel(aGrid);
//initalise Button and add button to panel
for(int i=0;i
{
aButton[i] = new JButton(aString[i]);
aPane.add(aButton[i]);
}
getContentPane().setLayout(aBorder);
aTextField = new JTextField();
getContentPane().add(aTextField,BorderLayout.NORTH);
getContentPane().add(aPane,BorderLayout.CENTER);
}
}
No comments:
Post a Comment