just had a quick glimps of the code and it looks to me that you are getting a little confused with your globa variables. In you actionlistener "calculatorActions" class you are defining the variable "memoryNumber" as a local variable, not using the globally set one.
the code:
Code:
if (event.getActionCommand().equals("MS"))
{
temp = display.getText();
if (temp != null)
{
Toolkit.getDefaultToolkit().beep();
float memoryNumber = Float.valueOf(temp.trim()).floatValue();
memoryDisplay.setText("M");
}
}
will set a local variable called "memoryNumber" within the actionlistener class and, what you want to do is to keep the actionlistener class as a method of the main class calculatorGUI and implement actionlistener from the calculatorGUI class, im not sure why you are using it as a seperate class...
here is an example of what i mean:
(ill cut out the crap not needed)
Code:
class calculatorGUI implements ActionListener
{
...
... set variables other method etc...
...
public void actionPerformed(ActionEvent event){
your code for the buttons goes here... ie.
if (event.getActionCommand().equals("MS"))
{
temp = display.getText();
if (temp != null)
{
Toolkit.getDefaultToolkit().beep();
float memoryNumber = Float.valueOf(temp.trim()).floatValue();
memoryDisplay.setText("M");
}
}
}
} // end of actionPerformed
and so on
} // end of class
i hope i make some sort of sense...If i have made a complete blunder of somesort then im sorry, but thats what i saw...
Bookmarks