|
@ -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. |
|
|
*/ |
|
|
*/ |
|
@ -140,31 +143,31 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
this.loeschen = new JButton("L\u00F6schen"); |
|
|
this.loeschen = new JButton("L\u00F6schen"); |
|
|
loeschen.setBounds(368, 266, 89, 30); |
|
|
loeschen.setBounds(368, 266, 89, 30); |
|
|
contentPane.add(loeschen); |
|
|
contentPane.add(loeschen); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.exit = new JButton("Exit\r\n"); |
|
|
this.exit = new JButton("Exit\r\n"); |
|
|
exit.setBounds(494, 266, 95, 30); |
|
|
exit.setBounds(494, 266, 95, 30); |
|
|
contentPane.add(exit); |
|
|
contentPane.add(exit); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JLabel beendne = new JLabel("Beenden"); |
|
|
JLabel beendne = new JLabel("Beenden"); |
|
|
beendne.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14)); |
|
|
beendne.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14)); |
|
|
beendne.setBounds(508, 246, 81, 14); |
|
|
beendne.setBounds(508, 246, 81, 14); |
|
|
contentPane.add(beendne); |
|
|
contentPane.add(beendne); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.budgetDispaly = new JLabel("0.0 \u20AC"); |
|
|
this.budgetDispaly = new JLabel("0.0 \u20AC"); |
|
|
budgetDispaly.setFont(new Font("Tahoma", Font.BOLD, 12)); |
|
|
budgetDispaly.setFont(new Font("Tahoma", Font.BOLD, 12)); |
|
|
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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.text1.addActionListener(this); |
|
|
this.text1.addActionListener(this); |
|
|
this.text2.addActionListener(this); |
|
|
this.text2.addActionListener(this); |
|
|
this.senden.addActionListener(this); |
|
|
this.senden.addActionListener(this); |
|
@ -176,15 +179,22 @@ 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 + " €"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |