ciao a tutti sto cercando di implementare una calcolatrice con GUI per imparare qualche cosa ma non mi esceeeeeeeeeeeeeeeeee che palleeee!!
riporto solo il metodo ascoltatore:
public void actionPerformed(ActionEvent e) {
Integer sommastringa=new Integer(0);
if(txt.getText().equals("0"))
txt.setText("");
if(e.getActionCommand().equals("+") || e.getActionCommand().equals("-") || e.getActionCommand().equals("*")|| e.getActionCommand().equals("/") || e.getActionCommand().equals("=")){
operatore=e.getActionCommand();
segno.setText(operatore);
txt.setText("");
sommaparziale=Integer.parseInt(num);
sommaparziale=calcola(sommaparziale
operatore.charAt(0));
sommastringa= new Integer(sommaparziale);
txt.setText(sommastringa.toString())
txt.setText("");
}
else{
num=txt.getText();
num+=e.getActionCommand();
txt.setText(num);
}
}
il problema mi sa che è nelle istruzioni:
txt.setText(sommastringa.toString())
txt.setText("");
non mi visualizza il risultato di una somma, che palleeeee
chi sa spiegarmi perchè?
GRAZIEEEE E BUON ANNO A TUTTI!!