aspargus i didn't really get your method :S.
for(i = 0;i<10;i++){
button[ i ]=new Button(i.toString());
this.add(button); //This registers the button in the calculator's frame
button.setBounds(new Rectangle(x,y,35,28));
button.setFont(new Font("calibri", Font.PLAIN, 15));
button.setBackground(Color.lightGray);
switch(i){
case 0:
button.addActionListener(new Button0Handler(this));
break;
case 1:
button.addActionListener(new Button1Handler(this));
break;
case 2:
etc
}
and the button handlers:
class Button0Handler implements ActionListener{
CalculatorGui cg;
public Button0Handler(CalculatorGui cg){
this.cg=cg;
}
public void actionPerformed(ActionEvent pushingButton0){
CalculatorGui.op.addDigit('0'); //This is a method from another class in order to add the digit in a stack.
}
}
etc.
That's how the code is structured. What do i do exactly?