From 9ba86dbb67d13172aeb6a34337c7f21c8a547c2f Mon Sep 17 00:00:00 2001 From: Harry Linrui XU <xulr0820@hotmail.com> Date: Mon, 17 Apr 2023 11:30:56 +0200 Subject: [PATCH] Shortened error messages in alert box --- .../controller/IncomeExpenseController.java | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/src/main/java/no/ntnu/idatt1002/demo/controller/IncomeExpenseController.java b/src/main/java/no/ntnu/idatt1002/demo/controller/IncomeExpenseController.java index 7163bec9..855608f2 100644 --- a/src/main/java/no/ntnu/idatt1002/demo/controller/IncomeExpenseController.java +++ b/src/main/java/no/ntnu/idatt1002/demo/controller/IncomeExpenseController.java @@ -252,8 +252,7 @@ public class IncomeExpenseController implements FinanceController { * @param event A button click on the edit button. */ @Override - public void handleEditBtn(javafx.event.ActionEvent event) { - System.out.println(event.getSource()); + public void handleEditBtn(javafx.event.ActionEvent event) { Income chosenIncome = incomeTableView.getSelectionModel().getSelectedItem(); Expense chosenExpense = expenseTableView.getSelectionModel().getSelectedItem(); @@ -265,9 +264,6 @@ public class IncomeExpenseController implements FinanceController { boolean isDeleteExpense = event.getSource() == deleteExpenseMenu; - System.out.println(chosenIncome); - System.out.println(chosenExpense); - if (isEditIncome) { handleEditIncome(chosenIncome); } else if (isDeleteIncome) { @@ -333,8 +329,8 @@ public class IncomeExpenseController implements FinanceController { // Set the Dialog's content to the loaded FXML file dialog.getDialogPane().setContent(loader.load()); } catch (IOException e) { - showErrorDialogBox("Loading", "Error in loading dialog box", "An error occurred" - + "while loading AddIncome window"); + showErrorDialogBox("Loading", "Error in loading dialog box", "Could not load" + + "the AddIncome window"); } // Get the controller for the loaded FXML file @@ -369,8 +365,8 @@ public class IncomeExpenseController implements FinanceController { // Set the Dialog's content to the loaded FXML file dialog.getDialogPane().setContent(loader.load()); } catch (IOException e) { - showErrorDialogBox("Loading", "Error in loading dialog box", "An error occurred" - + "while loading AddExpense window"); + showErrorDialogBox("Loading", "Error in loading dialog box", "Could not load" + + "the AddExpense window"); } // Get the controller for the loaded FXML file @@ -407,8 +403,8 @@ public class IncomeExpenseController implements FinanceController { // Set the Dialog's content to the loaded FXML file dialog.getDialogPane().setContent(loader.load()); } catch (IOException e) { - showErrorDialogBox("Loading", "Error in loading dialog box", "An error occurred" - + "while loading EditIncome window"); + showErrorDialogBox("Loading", "Error in loading dialog box", "Could not load" + + "the EditIncome window"); } // Get the controller for the loaded FXML file @@ -439,8 +435,8 @@ public class IncomeExpenseController implements FinanceController { // Set the Dialog's content to the loaded FXML file dialog.getDialogPane().setContent(loader.load()); } catch (IOException e) { - showErrorDialogBox("Loading", "Error in loading dialog box", "An error occurred" - + "while loading EditExpense window"); + showErrorDialogBox("Loading", "Error in loading dialog box", "Could not" + + "load the EditExpense window"); } // Get the controller for the loaded FXML file @@ -531,8 +527,8 @@ public class IncomeExpenseController implements FinanceController { incomeRegister = fileHandling.readIncomeRegisterFromFile(fileName); } } catch (IOException ioe) { - showErrorDialogBox("File reading error", "Error in reading from file", "An error occurred" - + "while reading the IncomeRegister from file"); + showErrorDialogBox("File reading error", "Error in reading from file", "Could not" + + "read the IncomeRegister from file"); } return incomeRegister; } @@ -551,8 +547,8 @@ public class IncomeExpenseController implements FinanceController { expenseRegister = fileHandling.readExpenseRegisterFromFile(fileName); } } catch (IOException ioe) { - showErrorDialogBox("File reading error", "Error in reading from file", "An error occurred" - + "while reading the ExpenseRegister from file"); + showErrorDialogBox("File reading error", "Error in reading from file", "Could not" + + "read the ExpenseRegister from file"); } return expenseRegister; } @@ -572,8 +568,8 @@ public class IncomeExpenseController implements FinanceController { generalBudget = fileHandlingBudget.readGeneralBudgetFromFile(fileName); } } catch (IOException ioe) { - showErrorDialogBox("File reading error", "Error in reading from file", "An error occurred" - + "while reading the GeneralBudget from file"); + showErrorDialogBox("File reading error", "Error in reading from file", "Could not" + + "read the GeneralBudget from file"); } return generalBudget; } @@ -595,8 +591,8 @@ public class IncomeExpenseController implements FinanceController { stage.setScene(scene); stage.show(); } catch(IOException ioe) { - showErrorDialogBox("Loading error", "Error in loading", "An error occurred" - + "while saving saving to file and loading next window"); + showErrorDialogBox("Loading error", "Error in loading", "Could not save" + + "to file"); } } -- GitLab