|
@ -20,14 +20,6 @@ import javax.swing.JComboBox; |
|
|
import javax.swing.JTextArea; |
|
|
import javax.swing.JTextArea; |
|
|
import java.awt.Color; |
|
|
import java.awt.Color; |
|
|
import javax.swing.JSeparator; |
|
|
import javax.swing.JSeparator; |
|
|
import javax.swing.JScrollPane; |
|
|
|
|
|
import javax.swing.JTable; |
|
|
|
|
|
import javax.swing.table.DefaultTableModel; |
|
|
|
|
|
import javax.swing.border.EtchedBorder; |
|
|
|
|
|
import javax.swing.border.MatteBorder; |
|
|
|
|
|
import javax.swing.border.BevelBorder; |
|
|
|
|
|
import javax.swing.border.TitledBorder; |
|
|
|
|
|
import javax.swing.UIManager; |
|
|
|
|
|
|
|
|
|
|
|
public class MeinGui extends JFrame implements ActionListener { |
|
|
public class MeinGui extends JFrame implements ActionListener { |
|
|
|
|
|
|
|
@ -46,18 +38,7 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
public static JLabel budgetDispaly; |
|
|
public static JLabel budgetDispaly; |
|
|
public static JLabel expensesDisplay; |
|
|
public static JLabel expensesDisplay; |
|
|
public static JLabel balanceDisplay; |
|
|
public static JLabel balanceDisplay; |
|
|
<<<<<<< HEAD |
|
|
|
|
|
private JTextField textExpensesName; |
|
|
private JTextField textExpensesName; |
|
|
======= |
|
|
|
|
|
public static int budget; |
|
|
|
|
|
public static int expenses; |
|
|
|
|
|
public static int balance; |
|
|
|
|
|
public static JTextField textExpensesName; |
|
|
|
|
|
public static JLabel ausgabenName; |
|
|
|
|
|
private static JLabel ausgabenBetrag; |
|
|
|
|
|
private static JLabel budgetBetrag; |
|
|
|
|
|
private static JTable myTable; |
|
|
|
|
|
>>>>>>> master |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Launch the application. |
|
|
* Launch the application. |
|
@ -88,8 +69,8 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
contentPane.setLayout(null); |
|
|
contentPane.setLayout(null); |
|
|
|
|
|
|
|
|
this.berechne = new JButton("Berechne"); |
|
|
this.berechne = new JButton("Berechne"); |
|
|
berechne.setBounds(78, 281, 110, 23); |
|
|
|
|
|
berechne.setToolTipText(""); |
|
|
berechne.setToolTipText(""); |
|
|
|
|
|
berechne.setBounds(78, 281, 110, 23); |
|
|
contentPane.add(berechne); |
|
|
contentPane.add(berechne); |
|
|
|
|
|
|
|
|
this.senden = new JButton("Senden"); |
|
|
this.senden = new JButton("Senden"); |
|
@ -107,16 +88,16 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
text2.setColumns(10); |
|
|
text2.setColumns(10); |
|
|
|
|
|
|
|
|
labelHauptImage = new JLabel(""); |
|
|
labelHauptImage = new JLabel(""); |
|
|
labelHauptImage.setBounds(10, 0, 86, 61); |
|
|
|
|
|
Image image0 = new ImageIcon(this.getClass().getResource("/budgetapp.png")).getImage(); |
|
|
Image image0 = new ImageIcon(this.getClass().getResource("/budgetapp.png")).getImage(); |
|
|
labelHauptImage.setIcon(new ImageIcon(image0)); |
|
|
labelHauptImage.setIcon(new ImageIcon(image0)); |
|
|
|
|
|
|
|
|
labelHauptImage.setFont(new Font("Tahoma", Font.BOLD, 13)); |
|
|
labelHauptImage.setFont(new Font("Tahoma", Font.BOLD, 13)); |
|
|
|
|
|
labelHauptImage.setBounds(10, 0, 86, 61); |
|
|
contentPane.add(labelHauptImage); |
|
|
contentPane.add(labelHauptImage); |
|
|
|
|
|
|
|
|
JLabel budgetEingeben = new JLabel("Budget eingeben"); |
|
|
JLabel budgetEingeben = new JLabel("Budget eingeben"); |
|
|
budgetEingeben.setBounds(10, 72, 110, 20); |
|
|
|
|
|
budgetEingeben.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14)); |
|
|
budgetEingeben.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14)); |
|
|
|
|
|
budgetEingeben.setBounds(10, 72, 110, 20); |
|
|
contentPane.add(budgetEingeben); |
|
|
contentPane.add(budgetEingeben); |
|
|
|
|
|
|
|
|
JLabel labelBudget = new JLabel("Budget"); |
|
|
JLabel labelBudget = new JLabel("Budget"); |
|
@ -132,103 +113,70 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
contentPane.add(labelBalance); |
|
|
contentPane.add(labelBalance); |
|
|
|
|
|
|
|
|
labelBudgetImage = new JLabel(""); |
|
|
labelBudgetImage = new JLabel(""); |
|
|
labelBudgetImage.setBounds(255, 22, 46, 55); |
|
|
|
|
|
Image image1 = new ImageIcon(this.getClass().getResource("/money.png")).getImage(); |
|
|
Image image1 = new ImageIcon(this.getClass().getResource("/money.png")).getImage(); |
|
|
labelBudgetImage.setIcon(new ImageIcon(image1)); |
|
|
labelBudgetImage.setIcon(new ImageIcon(image1)); |
|
|
|
|
|
|
|
|
|
|
|
labelBudgetImage.setBounds(255, 22, 46, 55); |
|
|
contentPane.add(labelBudgetImage); |
|
|
contentPane.add(labelBudgetImage); |
|
|
|
|
|
|
|
|
labelExpensesImage = new JLabel(""); |
|
|
labelExpensesImage = new JLabel(""); |
|
|
labelExpensesImage.setBounds(400, 22, 46, 55); |
|
|
|
|
|
Image image2 = new ImageIcon(this.getClass().getResource("/wings-icon.png")).getImage(); |
|
|
Image image2 = new ImageIcon(this.getClass().getResource("/wings-icon.png")).getImage(); |
|
|
labelExpensesImage.setIcon(new ImageIcon(image2)); |
|
|
labelExpensesImage.setIcon(new ImageIcon(image2)); |
|
|
|
|
|
|
|
|
|
|
|
labelExpensesImage.setBounds(400, 22, 46, 55); |
|
|
contentPane.add(labelExpensesImage); |
|
|
contentPane.add(labelExpensesImage); |
|
|
|
|
|
|
|
|
labelBalancetImage = new JLabel("New labelBalance"); |
|
|
labelBalancetImage = new JLabel("New labelBalance"); |
|
|
labelBalancetImage.setBounds(543, 22, 34, 55); |
|
|
|
|
|
Image image3 = new ImageIcon(this.getClass().getResource("/Money-icon.png")).getImage(); |
|
|
Image image3 = new ImageIcon(this.getClass().getResource("/Money-icon.png")).getImage(); |
|
|
labelBalancetImage.setIcon(new ImageIcon(image3)); |
|
|
labelBalancetImage.setIcon(new ImageIcon(image3)); |
|
|
|
|
|
|
|
|
|
|
|
labelBalancetImage.setBounds(543, 22, 34, 55); |
|
|
contentPane.add(labelBalancetImage); |
|
|
contentPane.add(labelBalancetImage); |
|
|
|
|
|
|
|
|
JLabel budgetAusgeben = new JLabel("Ausgaben"); |
|
|
JLabel budgetAusgeben = new JLabel("Ausgaben"); |
|
|
budgetAusgeben.setBounds(10, 185, 63, 14); |
|
|
|
|
|
budgetAusgeben.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14)); |
|
|
budgetAusgeben.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14)); |
|
|
|
|
|
budgetAusgeben.setBounds(10, 185, 63, 14); |
|
|
contentPane.add(budgetAusgeben); |
|
|
contentPane.add(budgetAusgeben); |
|
|
|
|
|
|
|
|
this.leeren = new JLabel("Leeren"); |
|
|
|
|
|
leeren.setBounds(317, 253, 115, 14); |
|
|
|
|
|
|
|
|
this.leeren = new JLabel("Eintr\u00E4ge leeren"); |
|
|
leeren.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14)); |
|
|
leeren.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14)); |
|
|
|
|
|
leeren.setBounds(363, 246, 115, 14); |
|
|
contentPane.add(leeren); |
|
|
contentPane.add(leeren); |
|
|
|
|
|
|
|
|
this.loeschen = new JButton("L\u00F6schen"); |
|
|
this.loeschen = new JButton("L\u00F6schen"); |
|
|
loeschen.setBounds(301, 281, 89, 23); |
|
|
|
|
|
|
|
|
loeschen.setBounds(368, 273, 89, 23); |
|
|
contentPane.add(loeschen); |
|
|
contentPane.add(loeschen); |
|
|
|
|
|
|
|
|
this.exit = new JButton("Exit\r\n"); |
|
|
this.exit = new JButton("Exit\r\n"); |
|
|
exit.setBounds(477, 281, 95, 23); |
|
|
|
|
|
|
|
|
exit.setBounds(494, 273, 95, 23); |
|
|
contentPane.add(exit); |
|
|
contentPane.add(exit); |
|
|
|
|
|
|
|
|
JLabel beendne = new JLabel("Beenden"); |
|
|
JLabel beendne = new JLabel("Beenden"); |
|
|
beendne.setBounds(491, 253, 81, 14); |
|
|
|
|
|
beendne.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14)); |
|
|
beendne.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14)); |
|
|
|
|
|
beendne.setBounds(508, 246, 81, 14); |
|
|
contentPane.add(beendne); |
|
|
contentPane.add(beendne); |
|
|
|
|
|
|
|
|
budgetDispaly = new JLabel("0.0 \u20AC"); |
|
|
budgetDispaly = new JLabel("0.0 \u20AC"); |
|
|
budgetDispaly.setBounds(255, 82, 86, 14); |
|
|
|
|
|
budgetDispaly.setFont(new Font("Tahoma", Font.BOLD, 12)); |
|
|
budgetDispaly.setFont(new Font("Tahoma", Font.BOLD, 12)); |
|
|
|
|
|
budgetDispaly.setBounds(255, 82, 86, 14); |
|
|
contentPane.add(budgetDispaly); |
|
|
contentPane.add(budgetDispaly); |
|
|
|
|
|
|
|
|
expensesDisplay = new JLabel("0.0 \u20AC"); |
|
|
expensesDisplay = new JLabel("0.0 \u20AC"); |
|
|
expensesDisplay.setBounds(390, 82, 110, 14); |
|
|
|
|
|
expensesDisplay.setFont(new Font("Tahoma", Font.BOLD, 12)); |
|
|
expensesDisplay.setFont(new Font("Tahoma", Font.BOLD, 12)); |
|
|
|
|
|
expensesDisplay.setBounds(390, 82, 110, 14); |
|
|
contentPane.add(expensesDisplay); |
|
|
contentPane.add(expensesDisplay); |
|
|
|
|
|
|
|
|
balanceDisplay = new JLabel("0.0 \u20AC"); |
|
|
balanceDisplay = new JLabel("0.0 \u20AC"); |
|
|
balanceDisplay.setBounds(543, 82, 85, 14); |
|
|
|
|
|
balanceDisplay.setFont(new Font("Tahoma", Font.BOLD, 12)); |
|
|
balanceDisplay.setFont(new Font("Tahoma", Font.BOLD, 12)); |
|
|
|
|
|
balanceDisplay.setBounds(543, 82, 85, 14); |
|
|
contentPane.add(balanceDisplay); |
|
|
contentPane.add(balanceDisplay); |
|
|
|
|
|
|
|
|
textExpensesName = new JTextField(); |
|
|
textExpensesName = new JTextField(); |
|
|
textExpensesName.setBounds(60, 221, 128, 20); |
|
|
|
|
|
textExpensesName.setToolTipText(""); |
|
|
textExpensesName.setToolTipText(""); |
|
|
|
|
|
textExpensesName.setBounds(60, 221, 128, 20); |
|
|
contentPane.add(textExpensesName); |
|
|
contentPane.add(textExpensesName); |
|
|
textExpensesName.setColumns(10); |
|
|
textExpensesName.setColumns(10); |
|
|
|
|
|
|
|
|
ausgabenName = new JLabel(" Name"); |
|
|
|
|
|
ausgabenName.setBounds(10, 224, 46, 14); |
|
|
|
|
|
contentPane.add(ausgabenName); |
|
|
|
|
|
|
|
|
|
|
|
ausgabenBetrag = new JLabel(" Betrag"); |
|
|
|
|
|
ausgabenBetrag.setBounds(10, 253, 46, 14); |
|
|
|
|
|
contentPane.add(ausgabenBetrag); |
|
|
|
|
|
|
|
|
|
|
|
budgetBetrag = new JLabel(" Betrag"); |
|
|
|
|
|
budgetBetrag.setBounds(10, 100, 46, 14); |
|
|
|
|
|
contentPane.add(budgetBetrag); |
|
|
|
|
|
|
|
|
|
|
|
JScrollPane scrollPane_1 = new JScrollPane(); |
|
|
|
|
|
scrollPane_1.setBounds(347, 126, 136, 88); |
|
|
|
|
|
contentPane.add(scrollPane_1); |
|
|
|
|
|
|
|
|
|
|
|
myTable = new JTable(); |
|
|
|
|
|
myTable.setColumnSelectionAllowed(true); |
|
|
|
|
|
myTable.setCellSelectionEnabled(true); |
|
|
|
|
|
myTable.setBorder(UIManager.getBorder("Tree.editorBorder")); |
|
|
|
|
|
myTable.setFont(new Font("Tahoma", Font.BOLD, 11)); |
|
|
|
|
|
myTable.setModel(new DefaultTableModel(new Object[][] {}, new String[] { "Name", "Kosten" }) { |
|
|
|
|
|
Class[] columnTypes = new Class[] { String.class, Integer.class }; |
|
|
|
|
|
|
|
|
|
|
|
public Class getColumnClass(int columnIndex) { |
|
|
|
|
|
return columnTypes[columnIndex]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
boolean[] columnEditables = new boolean[] { false, false }; |
|
|
|
|
|
|
|
|
|
|
|
public boolean isCellEditable(int row, int column) { |
|
|
|
|
|
return columnEditables[column]; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
scrollPane_1.setViewportView(myTable); |
|
|
|
|
|
|
|
|
|
|
|
text1.addActionListener(this); |
|
|
text1.addActionListener(this); |
|
|
text2.addActionListener(this); |
|
|
text2.addActionListener(this); |
|
|
senden.addActionListener(this); |
|
|
senden.addActionListener(this); |
|
@ -258,10 +206,7 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
expensesDisplay.setText(setExpensesView()); |
|
|
expensesDisplay.setText(setExpensesView()); |
|
|
Calculations.setBalance(Integer.parseInt(text1.getText()) - Integer.parseInt(text2.getText())) ; |
|
|
Calculations.setBalance(Integer.parseInt(text1.getText()) - Integer.parseInt(text2.getText())) ; |
|
|
balanceDisplay.setText(setBalanceView()); |
|
|
balanceDisplay.setText(setBalanceView()); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
DefaultTableModel tab = (DefaultTableModel)myTable.getModel(); |
|
|
|
|
|
tab.addRow(new Object [] {(textExpensesName.getText()) , Integer.parseInt(text2.getText())}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -270,15 +215,14 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static void leerButton() { |
|
|
public static void leerButton() { |
|
|
text1.setText(null); |
|
|
|
|
|
text2.setText(null); |
|
|
|
|
|
budgetDispaly.setText(null); |
|
|
|
|
|
expensesDisplay.setText(null); |
|
|
|
|
|
balanceDisplay.setText(null); |
|
|
|
|
|
textExpensesName.setText(null); |
|
|
|
|
|
((DefaultTableModel)myTable.getModel()).setRowCount(0); |
|
|
|
|
|
|
|
|
text1.setText(""); |
|
|
|
|
|
text2.setText(""); |
|
|
|
|
|
budgetDispaly.setText(""); |
|
|
|
|
|
expensesDisplay.setText(""); |
|
|
|
|
|
balanceDisplay.setText(""); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String setBudgetView() { |
|
|
public static String setBudgetView() { |
|
|
String result = Calculations.getBudget() + " �"; |
|
|
String result = Calculations.getBudget() + " �"; |
|
|
return result; |
|
|
return result; |
|
@ -293,5 +237,4 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
String result = Calculations.getBalance() + " �"; |
|
|
String result = Calculations.getBalance() + " �"; |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |