|
@ -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 + " €"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |