I am trying to pass a simple string from a purchase class by throwing it in a getter, then trying to retrieve it from another class called pconfirm. Then trying to set the text of a label in that form to the amount being passed.
Purchase.java
private JLabel lblamnt;
public String amount() {
String gtext = lblamnt.getText();
return gtext;
}
Pconfirm.java
private JLabel lblgamnt;
public Pconfirm() {
Purchase purchase = new Purchase();
lblgamnt.setText("Test" + purchase.amount());
}
When i pass it it shows nothing.
I was under the presumption that you call it by Purchase.amount().