Galera, é o seguinte, estou começando aprender swing e de cara preciso fazer uma calculadora. Vi diversas calculadora, mas, eu queria desenvolver com a minha lógica para poder entender. No entanto, parei nesse código abaixo, a partir daí que seria os calculos não estou tendo noção do que poderia fazer. Se puderem me dar uma luz, ficarei grato
private class Calcula implements ActionListener{
String numero = "";
double total = 0;
double resul = 0;
public void actionPerformed(ActionEvent evento) {
// TODO Auto-generated method stub
int b1 = Integer.parseInt(n1.getText());
int b2 = Integer.parseInt(n2.getText());
int b3 = Integer.parseInt(n3.getText());
int b4 = Integer.parseInt(n4.getText());
int b5 = Integer.parseInt(n5.getText());
int b6 = Integer.parseInt(n6.getText());
int b7 = Integer.parseInt(n7.getText());
int b8 = Integer.parseInt(n8.getText());
int b9 = Integer.parseInt(n9.getText());
int b0 = Integer.parseInt(n0.getText());
if(evento.getSource()== n1){
numero = numero + ""+b1;
resultado.setText(""+Double.parseDouble(numero));
}
if(evento.getSource()== n2){
numero = numero + ""+b2;
resultado.setText(""+Double.parseDouble(numero));
}
if(evento.getSource()== n3){
numero = numero + ""+b3;
resultado.setText(""+Double.parseDouble(numero));
}
if(evento.getSource()== n4){
numero = numero + ""+b4;
resultado.setText(""+Double.parseDouble(numero));
}
if(evento.getSource()== n5){
numero = numero + ""+b5;
resultado.setText(""+Double.parseDouble(numero));
}
if(evento.getSource()== n6){
numero = numero + ""+b6;
resultado.setText(""+Double.parseDouble(numero));
}
if(evento.getSource()== n7){
numero = numero + ""+b7;
resultado.setText(""+Double.parseDouble(numero));
}
if(evento.getSource()== n8){
numero = numero + ""+b8;
resultado.setText(""+Double.parseDouble(numero));
}
if(evento.getSource()== n9){
numero = numero + ""+b9;
resultado.setText(""+Double.parseDouble(numero));
}
if(evento.getSource()== n0){
numero = numero + ""+b0;
resultado.setText(""+Double.parseDouble(numero));
}
}//fim metodo
}//fim da classe
