I'm using a Swing JFrame, and this method happened to work normally on Eclipse, but using it on Swing, it doesn't happen to work because:
- When I subtract it comes out as 0, always (900 - 90 = 0)
- If I add it doesn't add what was already there (90 + 90 = 90)
public void actionPerformed(ActionEvent arg0) {
textField_1.setText("0");
int qq = Integer.parseInt(textField.getText()); //Amount withdrawing or depositing
int qqq = Integer.parseInt(textField_1.getText()); //Amount in account
textField.setText(""+qq);
if (chckbxDeposit.isSelected()) {
int ok = qqq + qq;
textField_1.setText( ""+ok );
}
if (chckbxWithdraw.isSelected()) {
if (qqq > qq){
int pq = (qqq - qq);
textField_1.setText( ""+pq );
}
if (qqq < qq){
// textField_1.setText( ""+qq );
label.setText( "You don't have enough balance in your account to withdraw"+qq );
}
}
if (chckbxWithdraw.isSelected() && chckbxDeposit.isSelected()) {
textField_1.setText( "" );
}
Aucun commentaire:
Enregistrer un commentaire