|
|
@ -22,8 +22,8 @@ import javax.swing.JSeparator; |
|
|
|
public class MeinGui extends JFrame implements ActionListener { |
|
|
|
|
|
|
|
private JPanel contentPane; |
|
|
|
private JTextField text1; |
|
|
|
private JTextField text2; |
|
|
|
private static JTextField text1; |
|
|
|
private static JTextField text2; |
|
|
|
JLabel labelBudgetImage; |
|
|
|
JLabel labelExpensesImage; |
|
|
|
JLabel labelBalancetImage; |
|
|
@ -33,9 +33,12 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
|
JLabel leeren; |
|
|
|
JButton loeschen; |
|
|
|
JButton exit; |
|
|
|
private JLabel budgetDispaly; |
|
|
|
private JLabel expensesDisplay; |
|
|
|
private JLabel balanceDisplay; |
|
|
|
private static JLabel budgetDispaly; |
|
|
|
private static JLabel expensesDisplay; |
|
|
|
private static JLabel balanceDisplay; |
|
|
|
private static int budget; |
|
|
|
private static int expenses; |
|
|
|
private static int balance; |
|
|
|
|
|
|
|
/** |
|
|
|
* Launch the application. |
|
|
@ -153,27 +156,27 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
|
beendne.setBounds(508, 246, 81, 14); |
|
|
|
contentPane.add(beendne); |
|
|
|
|
|
|
|
this.budgetDispaly = new JLabel("0.0 \u20AC"); |
|
|
|
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); |
|
|
|
budgetDispaly.setBounds(255, 82, 86, 14); |
|
|
|
contentPane.add(budgetDispaly); |
|
|
|
|
|
|
|
this.expensesDisplay = new JLabel("0.0 \u20AC"); |
|
|
|
expensesDisplay = new JLabel("0.0 \u20AC"); |
|
|
|
expensesDisplay.setFont(new Font("Tahoma", Font.BOLD, 12)); |
|
|
|
expensesDisplay.setBounds(390, 82, 110, 14); |
|
|
|
contentPane.add(expensesDisplay); |
|
|
|
|
|
|
|
this.balanceDisplay = new JLabel("0.0 \u20AC"); |
|
|
|
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); |
|
|
|
this.berechne.addActionListener(this); |
|
|
|
this.loeschen.addActionListener(this); |
|
|
|
this.exit.addActionListener(this); |
|
|
|
text1.addActionListener(this); |
|
|
|
text2.addActionListener(this); |
|
|
|
senden.addActionListener(this); |
|
|
|
berechne.addActionListener(this); |
|
|
|
loeschen.addActionListener(this); |
|
|
|
exit.addActionListener(this); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
@ -183,20 +186,20 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
|
if (ae.getSource() == this.exit) { |
|
|
|
exitButton(); |
|
|
|
} |
|
|
|
|
|
|
|
if (ae.getSource() == this.loeschen) { |
|
|
|
leerButton(); |
|
|
|
} |
|
|
|
|
|
|
|
int budget = Integer.parseInt(this.text1.getText()); |
|
|
|
if (ae.getSource() == this.senden && (this.text1 != null && this.text2 != null)) { |
|
|
|
this.budgetDispaly.setText(budget + " €"); |
|
|
|
budget = Integer.parseInt(text1.getText()); |
|
|
|
if (ae.getSource() == this.senden && (text1 != null && text2 != null)) { |
|
|
|
BudgetView(); |
|
|
|
} |
|
|
|
|
|
|
|
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 + " €"); |
|
|
|
if (ae.getSource() == this.berechne && (text1 != null && text2 != null)) { |
|
|
|
expenses = budget - Integer.parseInt(text2.getText()); |
|
|
|
//expensesView(); |
|
|
|
balance = Integer.parseInt(text1.getText()) - Integer.parseInt(text2.getText()); |
|
|
|
//balanceView(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
@ -205,12 +208,28 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
|
System.exit(0); |
|
|
|
} |
|
|
|
|
|
|
|
public void leerButton() { |
|
|
|
this.text1.setText(""); |
|
|
|
this.text2.setText(""); |
|
|
|
this.budgetDispaly.setText(""); |
|
|
|
this.expensesDisplay.setText(""); |
|
|
|
this.balanceDisplay.setText(""); |
|
|
|
public static void leerButton() { |
|
|
|
text1.setText(""); |
|
|
|
text2.setText(""); |
|
|
|
budgetDispaly.setText(""); |
|
|
|
expensesDisplay.setText(""); |
|
|
|
balanceDisplay.setText(""); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void BudgetView() { |
|
|
|
budgetDispaly.setText(budget + " €"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
public static void expensesView() { |
|
|
|
expensesDisplay.setText(expenses - budget + " €"); |
|
|
|
} |
|
|
|
|
|
|
|
public static void balanceView() { |
|
|
|
balanceDisplay.setText(balance + " €"); |
|
|
|
} |
|
|
|
|
|
|
|
**/ |
|
|
|
} |