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. 36
      Budget Projekt/src/MeinBudgetView/MeinGui.java

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

BIN
Budget Projekt/bin/MeinBudgetView/MeinGui.class

36
Budget Projekt/src/MeinBudgetView/MeinGui.java

@ -34,6 +34,9 @@ public class MeinGui extends JFrame implements ActionListener {
JButton loeschen;
JButton exit;
private JLabel budgetDispaly;
private JLabel expensesDisplay;
private JLabel balanceDisplay;
/**
* Launch the application.
*/
@ -140,31 +143,31 @@ public class MeinGui extends JFrame implements ActionListener {
this.loeschen = new JButton("L\u00F6schen");
loeschen.setBounds(368, 266, 89, 30);
contentPane.add(loeschen);
this.exit = new JButton("Exit\r\n");
exit.setBounds(494, 266, 95, 30);
contentPane.add(exit);
JLabel beendne = new JLabel("Beenden");
beendne.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14));
beendne.setBounds(508, 246, 81, 14);
contentPane.add(beendne);
this.budgetDispaly = new JLabel("0.0 \u20AC");
budgetDispaly.setFont(new Font("Tahoma", Font.BOLD, 12));
this.budgetDispaly.setBounds(255, 82, 86, 14);
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.setBounds(390, 82, 110, 14);
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.setBounds(543, 82, 85, 14);
contentPane.add(balanceDisplay);
this.text1.addActionListener(this);
this.text2.addActionListener(this);
this.senden.addActionListener(this);
@ -176,15 +179,22 @@ public class MeinGui extends JFrame implements ActionListener {
@Override
public void actionPerformed(ActionEvent ae) {
int budget = Integer.parseInt(this.text1.getText());
if (ae.getSource() == this.exit) {
System.exit(0);
}
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