Browse Source

Fehlerhandling eingebaut bei keiner Budget eingabe

master
eduardD 5 years ago
parent
commit
976edc7142
  1. BIN
      Budget Projekt/bin/MeinBudgetView/MeinGui$1.class
  2. BIN
      Budget Projekt/bin/MeinBudgetView/MeinGui.class
  3. 42
      Budget Projekt/src/MeinBudgetView/MeinGui.java

BIN
Budget Projekt/bin/MeinBudgetView/MeinGui$1.class

BIN
Budget Projekt/bin/MeinBudgetView/MeinGui.class

42
Budget Projekt/src/MeinBudgetView/MeinGui.java

@ -28,6 +28,7 @@ import javax.swing.border.MatteBorder;
import javax.swing.border.BevelBorder;
import javax.swing.border.TitledBorder;
import javax.swing.UIManager;
import static javax.swing.JOptionPane.showMessageDialog;
public class MeinGui extends JFrame implements ActionListener {
@ -276,15 +277,23 @@ public class MeinGui extends JFrame implements ActionListener {
@Override
public void actionPerformed(ActionEvent ae) {
try {
budget = Double.parseDouble(text1.getText());
} catch (Exception e) {
showMessageDialog(null, "Sie müssen ihr Budget eingeben!");
}
if (ae.getSource() == this.exit) {
exitButton();
}
if (ae.getSource() == this.loeschen) {
leeren();
}
budget = Double.parseDouble(text1.getText());
if (ae.getSource() == this.senden && (text1 != null && text2 != null)) {
budgetDispaly.setText(setBudgetView());
}
@ -306,19 +315,24 @@ public class MeinGui extends JFrame implements ActionListener {
}
private void erspartesHinzufuegen() {
erspartes += (budget - expenses);
budget = 0.0;
expenses = 0.0;
balance = 0.0;
text1.setText(null);
text2.setText(null);
budgetDispaly.setText("0.0 \u20AC");
expensesDisplay.setText("0.0 \u20AC");
balanceDisplay.setText("0.0 \u20AC");
savingsDisplay.setText(Double.toString(erspartes));
textExpensesName.setText(null);
((DefaultTableModel) myTable.getModel()).setRowCount(0);
private void erspartesHinzufuegen() {
try {
erspartes += (budget - expenses);
budget = 0.0;
expenses = 0.0;
balance = 0.0;
text1.setText(null);
text2.setText(null);
budgetDispaly.setText("0.0 \u20AC");
expensesDisplay.setText("0.0 \u20AC");
balanceDisplay.setText("0.0 \u20AC");
savingsDisplay.setText(Double.toString(erspartes));
textExpensesName.setText(null);
((DefaultTableModel) myTable.getModel()).setRowCount(0);
} catch (Exception e) {
showMessageDialog(null, "Sie müssen ihr Budget und ihre Ausgaben eingeben!");
}
}

Loading…
Cancel
Save