Javaを使用して、クラスのテキストボックスの値を別のクラスの別のテキストボックスに渡したい. PurchaseSystem と別の PaymentSystem というクラスがあり、PurchaseSystem から PaymentSystem に値を渡したいと考えています。
private void btnMakePaymentActionPerformed(java.awt.event.ActionEvent evt) {
String selected;
new PaymentSystem().setVisible(true);
PaymentSystem information;
information = new PaymentSystem();
information.itemChoosen = txtDisplayItem.getText();
information.itemPrice = txtDisplayPrice.getSelectedText();
information.setVisible(true);
}
public class PaymentSystem extends javax.swing.JFrame {
public String itemChoosen, itemPrice, itemQuantity, itemSubTotal;
/**
* Creates new form PaymentSystem
*/
public PaymentSystem() {
initComponents();
itemTextBox.setText(itemChoosen);
priceTextBox.setText(itemPrice);
}
これは私がこれまで行ってきたことですが、 PurchaseSystem クラスの値が PaymentSystem クラスのテキストボックスに表示されません。親切に助けて