I am trying to access a varible value from a return fuction in another class. Everytime I attempt to access the variable, it returns a null value. This is selecting from a choice control
Part of the first class called CheeseBread
public void itemStateChanged(ItemEvent e)
{
if(e.getSource() == total1)
{
calc1(total.getSelectedItem());
}
if(e.getSource() == total2)
{
calc2(total2.getSelectedItem());
}
if(e.getSource() == total3)
{
calc3(cheese.getSelectedItem());
}
}
public static void calc1(String answer)
{
mchoice = answer;
}
public String ranswer()
{
return mchoice;
}
This is part of the second class attempting to retreive the values
public class SandwichShop extends JApplet
{
private static final long serialVersionUID = 1L;
private CheeseBread Panel1= new CheeseBread();
private String one, two, three;
private JTextField wow = new JTextField(9);
public void init()
{
JPanel bigpanel = new JPanel();
bigpanel.setLayout(new BoxLayout(bigpanel, BoxLayout.Y_AXIS));
bigpanel.add(Panel1);
bigpanel.add(Panel2);
bigpanel.add(Panel3);
bigpanel.add(Panel4);
bigpanel.add(dumb);
String test= ("wow");
getContentPane().add(bigpanel, "Center");
MeatBreadCheese.calcMPrice(wow);
two = Panel1.rBread();
three = Panel1.rCheese();
wow.setText(test);
System.out.print(wow);
setSize(500,500);
}
}