Browse Source

Commit_10 Methode actionPerformed implementiert mit Funktionlitäten

Eduard2
Adah Boukhari 5 years ago
parent
commit
18f0a0baf8
  1. BIN
      Budget Projekt/bin/MeinBudgetView/MeinGui$1.class
  2. BIN
      Budget Projekt/bin/MeinBudgetView/MeinGui.class
  3. 18
      Budget Projekt/src/MeinBudgetView/MeinGui.java

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

BIN
Budget Projekt/bin/MeinBudgetView/MeinGui.class

18
Budget Projekt/src/MeinBudgetView/MeinGui.java

@ -34,6 +34,9 @@ public class MeinGui extends JFrame implements ActionListener {
JButton loeschen; JButton loeschen;
JButton exit; JButton exit;
private JLabel budgetDispaly; private JLabel budgetDispaly;
private JLabel expensesDisplay;
private JLabel balanceDisplay;
/** /**
* Launch the application. * Launch the application.
*/ */
@ -155,12 +158,12 @@ public class MeinGui extends JFrame implements ActionListener {
this.budgetDispaly.setBounds(255, 82, 86, 14); this.budgetDispaly.setBounds(255, 82, 86, 14);
contentPane.add(this.budgetDispaly); contentPane.add(this.budgetDispaly);
JLabel expensesDisplay = new JLabel("0.0 \u20AC");
this.expensesDisplay = new JLabel("0.0 \u20AC");
expensesDisplay.setFont(new Font("Tahoma", Font.BOLD, 12)); expensesDisplay.setFont(new Font("Tahoma", Font.BOLD, 12));
expensesDisplay.setBounds(390, 82, 110, 14); expensesDisplay.setBounds(390, 82, 110, 14);
contentPane.add(expensesDisplay); contentPane.add(expensesDisplay);
JLabel balanceDisplay = new JLabel("0.0 \u20AC");
this.balanceDisplay = new JLabel("0.0 \u20AC");
balanceDisplay.setFont(new Font("Tahoma", Font.BOLD, 12)); balanceDisplay.setFont(new Font("Tahoma", Font.BOLD, 12));
balanceDisplay.setBounds(543, 82, 85, 14); balanceDisplay.setBounds(543, 82, 85, 14);
contentPane.add(balanceDisplay); contentPane.add(balanceDisplay);
@ -177,14 +180,21 @@ public class MeinGui extends JFrame implements ActionListener {
@Override @Override
public void actionPerformed(ActionEvent ae) { public void actionPerformed(ActionEvent ae) {
int budget = Integer.parseInt(this.text1.getText());
if (ae.getSource() == this.exit) { if (ae.getSource() == this.exit) {
System.exit(0); System.exit(0);
} }
if (ae.getSource() == this.senden && (this.text1 != null && this.text2 != null)) { if (ae.getSource() == this.senden && (this.text1 != null && this.text2 != null)) {
//this.text2.setText(this.text1.getText() + " ");
this.budgetDispaly.setText(this.text1.getText() + " €");
this.budgetDispaly.setText(budget + " ");
}
if (ae.getSource() == this.berechne && (this.text1 != null && this.text2 != null)) {
int expenses = budget - Integer.parseInt(this.text2.getText());
this.expensesDisplay.setText(expenses - budget + " €");
this.balanceDisplay.setText(expenses + " €");
} }
} }
} }
Loading…
Cancel
Save