|
|
@ -20,14 +20,6 @@ import javax.swing.JComboBox; |
|
|
|
import javax.swing.JTextArea; |
|
|
|
import java.awt.Color; |
|
|
|
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 { |
|
|
|
|
|
|
@ -46,18 +38,7 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
|
public static JLabel budgetDispaly; |
|
|
|
public static JLabel expensesDisplay; |
|
|
|
public static JLabel balanceDisplay; |
|
|
|
<<<<<<< HEAD |
|
|
|
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. |
|
|
@ -88,8 +69,8 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
|
contentPane.setLayout(null); |
|
|
|
|
|
|
|
this.berechne = new JButton("Berechne"); |
|
|
|
berechne.setBounds(78, 281, 110, 23); |
|
|
|
berechne.setToolTipText(""); |
|
|
|
berechne.setBounds(78, 281, 110, 23); |
|
|
|
contentPane.add(berechne); |
|
|
|
|
|
|
|
this.senden = new JButton("Senden"); |
|
|
@ -107,16 +88,16 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
|
text2.setColumns(10); |
|
|
|
|
|
|
|
labelHauptImage = new JLabel(""); |
|
|
|
labelHauptImage.setBounds(10, 0, 86, 61); |
|
|
|
Image image0 = new ImageIcon(this.getClass().getResource("/budgetapp.png")).getImage(); |
|
|
|
labelHauptImage.setIcon(new ImageIcon(image0)); |
|
|
|
|
|
|
|
labelHauptImage.setFont(new Font("Tahoma", Font.BOLD, 13)); |
|
|
|
labelHauptImage.setBounds(10, 0, 86, 61); |
|
|
|
contentPane.add(labelHauptImage); |
|
|
|
|
|
|
|
JLabel budgetEingeben = new JLabel("Budget eingeben"); |
|
|
|
budgetEingeben.setBounds(10, 72, 110, 20); |
|
|
|
budgetEingeben.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14)); |
|
|
|
budgetEingeben.setBounds(10, 72, 110, 20); |
|
|
|
contentPane.add(budgetEingeben); |
|
|
|
|
|
|
|
JLabel labelBudget = new JLabel("Budget"); |
|
|
@ -132,103 +113,70 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
|
contentPane.add(labelBalance); |
|
|
|
|
|
|
|
labelBudgetImage = new JLabel(""); |
|
|
|
labelBudgetImage.setBounds(255, 22, 46, 55); |
|
|
|
Image image1 = new ImageIcon(this.getClass().getResource("/money.png")).getImage(); |
|
|
|
labelBudgetImage.setIcon(new ImageIcon(image1)); |
|
|
|
|
|
|
|
labelBudgetImage.setBounds(255, 22, 46, 55); |
|
|
|
contentPane.add(labelBudgetImage); |
|
|
|
|
|
|
|
labelExpensesImage = new JLabel(""); |
|
|
|
labelExpensesImage.setBounds(400, 22, 46, 55); |
|
|
|
Image image2 = new ImageIcon(this.getClass().getResource("/wings-icon.png")).getImage(); |
|
|
|
labelExpensesImage.setIcon(new ImageIcon(image2)); |
|
|
|
|
|
|
|
labelExpensesImage.setBounds(400, 22, 46, 55); |
|
|
|
contentPane.add(labelExpensesImage); |
|
|
|
|
|
|
|
labelBalancetImage = new JLabel("New labelBalance"); |
|
|
|
labelBalancetImage.setBounds(543, 22, 34, 55); |
|
|
|
Image image3 = new ImageIcon(this.getClass().getResource("/Money-icon.png")).getImage(); |
|
|
|
labelBalancetImage.setIcon(new ImageIcon(image3)); |
|
|
|
|
|
|
|
labelBalancetImage.setBounds(543, 22, 34, 55); |
|
|
|
contentPane.add(labelBalancetImage); |
|
|
|
|
|
|
|
JLabel budgetAusgeben = new JLabel("Ausgaben"); |
|
|
|
budgetAusgeben.setBounds(10, 185, 63, 14); |
|
|
|
budgetAusgeben.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14)); |
|
|
|
budgetAusgeben.setBounds(10, 185, 63, 14); |
|
|
|
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.setBounds(363, 246, 115, 14); |
|
|
|
contentPane.add(leeren); |
|
|
|
|
|
|
|
this.loeschen = new JButton("L\u00F6schen"); |
|
|
|
loeschen.setBounds(301, 281, 89, 23); |
|
|
|
loeschen.setBounds(368, 273, 89, 23); |
|
|
|
contentPane.add(loeschen); |
|
|
|
|
|
|
|
this.exit = new JButton("Exit\r\n"); |
|
|
|
exit.setBounds(477, 281, 95, 23); |
|
|
|
exit.setBounds(494, 273, 95, 23); |
|
|
|
contentPane.add(exit); |
|
|
|
|
|
|
|
JLabel beendne = new JLabel("Beenden"); |
|
|
|
beendne.setBounds(491, 253, 81, 14); |
|
|
|
beendne.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14)); |
|
|
|
beendne.setBounds(508, 246, 81, 14); |
|
|
|
contentPane.add(beendne); |
|
|
|
|
|
|
|
budgetDispaly = new JLabel("0.0 \u20AC"); |
|
|
|
budgetDispaly.setBounds(255, 82, 86, 14); |
|
|
|
budgetDispaly.setFont(new Font("Tahoma", Font.BOLD, 12)); |
|
|
|
budgetDispaly.setBounds(255, 82, 86, 14); |
|
|
|
contentPane.add(budgetDispaly); |
|
|
|
|
|
|
|
expensesDisplay = new JLabel("0.0 \u20AC"); |
|
|
|
expensesDisplay.setBounds(390, 82, 110, 14); |
|
|
|
expensesDisplay.setFont(new Font("Tahoma", Font.BOLD, 12)); |
|
|
|
expensesDisplay.setBounds(390, 82, 110, 14); |
|
|
|
contentPane.add(expensesDisplay); |
|
|
|
|
|
|
|
balanceDisplay = new JLabel("0.0 \u20AC"); |
|
|
|
balanceDisplay.setBounds(543, 82, 85, 14); |
|
|
|
balanceDisplay.setFont(new Font("Tahoma", Font.BOLD, 12)); |
|
|
|
balanceDisplay.setBounds(543, 82, 85, 14); |
|
|
|
contentPane.add(balanceDisplay); |
|
|
|
|
|
|
|
|
|
|
|
textExpensesName = new JTextField(); |
|
|
|
textExpensesName.setBounds(60, 221, 128, 20); |
|
|
|
textExpensesName.setToolTipText(""); |
|
|
|
textExpensesName.setBounds(60, 221, 128, 20); |
|
|
|
contentPane.add(textExpensesName); |
|
|
|
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); |
|
|
|
text2.addActionListener(this); |
|
|
|
senden.addActionListener(this); |
|
|
@ -258,11 +206,8 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
|
expensesDisplay.setText(setExpensesView()); |
|
|
|
Calculations.setBalance(Integer.parseInt(text1.getText()) - Integer.parseInt(text2.getText())) ; |
|
|
|
balanceDisplay.setText(setBalanceView()); |
|
|
|
|
|
|
|
} |
|
|
|
DefaultTableModel tab = (DefaultTableModel)myTable.getModel(); |
|
|
|
tab.addRow(new Object [] {(textExpensesName.getText()) , Integer.parseInt(text2.getText())}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public void exitButton() { |
|
|
@ -270,15 +215,14 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
|
} |
|
|
|
|
|
|
|
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() { |
|
|
|
String result = Calculations.getBudget() + " �"; |
|
|
|
return result; |
|
|
@ -292,6 +236,5 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
|
public static String setBalanceView() { |
|
|
|
String result = Calculations.getBalance() + " �"; |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |