update discard check

This commit is contained in:
buzzcode2007 2024-02-28 10:43:48 +08:00
parent 0433f5adae
commit 8444de9ad2

View file

@ -319,7 +319,7 @@ public class OnTransact extends javax.swing.JFrame {
// Window events // Window events
private void close_precheck(java.awt.event.WindowEvent evt) { private void close_precheck(java.awt.event.WindowEvent evt) {
boolean CLOSING_STATE = receipt.clear; boolean CLOSING_STATE = receipt.clear;
if (!receipt.clear) {CLOSING_STATE = confirm_discard();}; if (!receipt.clear) {CLOSING_STATE = reset();};
if (CLOSING_STATE) {evt.getWindow().dispose();}; if (CLOSING_STATE) {evt.getWindow().dispose();};
} }
@ -330,8 +330,7 @@ public class OnTransact extends javax.swing.JFrame {
private boolean jToggleButton_DiscardActionPerformed(java.awt.event.ActionEvent evt) { private boolean jToggleButton_DiscardActionPerformed(java.awt.event.ActionEvent evt) {
// When the discard button is clicked // When the discard button is clicked
boolean user_choice = confirm_discard(); boolean user_choice = reset();
if (user_choice) {init();};
jToggleButton_Discard.setSelected(false); jToggleButton_Discard.setSelected(false);
return (user_choice); return (user_choice);
}; };
@ -384,13 +383,14 @@ public class OnTransact extends javax.swing.JFrame {
refresh_interface(); refresh_interface();
}; };
public static void reset() { public static Boolean reset() {
/* Reset the transaction. */ /* Reset the transaction. */
Boolean DISCARD_STATE = (!transact.progress || confirm_discard()); Boolean DISCARD_STATE = (!transact.progress || confirm_discard());
if (DISCARD_STATE) { if (DISCARD_STATE) {
init(); init();
}; };
return (DISCARD_STATE);
}; };
private SpinnerNumberModel model_price = new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, .01); private SpinnerNumberModel model_price = new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, .01);