I have a JFrame with buttons and when I click one of the buttons an integer decreases by 1. I am trying to show the integer in another JFrame but when I reference it I get an error saying non static variable cannot be referenced in a static context. How can I make this a non static variable?
Here is the code from when a button is clicked.
private void DietPepsiBTNActionPerformed(java.awt.event.ActionEvent evt) {
MessageLBL.setText("Enjoy your Diet Pepsi!");
credit -= 1.00;
stCredit = Double.toString(credit);
CreditAMT.setText("$" + stCredit);
Refresh();
dietPepsi -= 1;