I have a buying system set up in one class (the Right Panel class) and it's working great, but my text field for displaying money available is in the Left Panel class.
When I click the buy button, it should subtract from the money amount and re-display the new money amount. This is the method I'm using (but it's not working)...
Right panel class
LeftPanel leftPanel = new LeftPanel();
//inside the button action listener
wallet -= InvPrice[comboIndex];
leftPanel.setMoney(wallet);
//end button action listener
Left panel class
public int getMoney() {
moneys = Integer.parseInt(txtMoney.getText());
return moneys;
}
public void setMoney (int money) {
this.moneys = money;
txtMoney.setText(""+money);
}
I think this would work, but the problem might be that it's not updating the left panel?