|
@ -44,12 +44,11 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
public static int budget; |
|
|
public static int budget; |
|
|
public static int expenses; |
|
|
public static int expenses; |
|
|
public static int balance; |
|
|
public static int balance; |
|
|
private JTextField textExpensesName; |
|
|
|
|
|
private JLabel ausgabenName; |
|
|
|
|
|
private JLabel ausgabenBetrag; |
|
|
|
|
|
private JLabel budgetBetrag; |
|
|
|
|
|
private JTable myTable; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static JTextField textExpensesName; |
|
|
|
|
|
public static JLabel ausgabenName; |
|
|
|
|
|
private static JLabel ausgabenBetrag; |
|
|
|
|
|
private static JLabel budgetBetrag; |
|
|
|
|
|
private static JTable myTable; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Launch the application. |
|
|
* Launch the application. |
|
@ -202,22 +201,15 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
contentPane.add(scrollPane_1); |
|
|
contentPane.add(scrollPane_1); |
|
|
|
|
|
|
|
|
myTable = new JTable(); |
|
|
myTable = new JTable(); |
|
|
myTable.setModel(new DefaultTableModel( |
|
|
|
|
|
new Object[][] { |
|
|
|
|
|
}, |
|
|
|
|
|
new String[] { |
|
|
|
|
|
"Name", "Kosten" |
|
|
|
|
|
} |
|
|
|
|
|
) { |
|
|
|
|
|
Class[] columnTypes = new Class[] { |
|
|
|
|
|
String.class, Integer.class |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
myTable.setModel(new DefaultTableModel(new Object[][] {}, new String[] { "Name", "Kosten" }) { |
|
|
|
|
|
Class[] columnTypes = new Class[] { String.class, Integer.class }; |
|
|
|
|
|
|
|
|
public Class getColumnClass(int columnIndex) { |
|
|
public Class getColumnClass(int columnIndex) { |
|
|
return columnTypes[columnIndex]; |
|
|
return columnTypes[columnIndex]; |
|
|
} |
|
|
} |
|
|
boolean[] columnEditables = new boolean[] { |
|
|
|
|
|
false, true |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean[] columnEditables = new boolean[] { false, false }; |
|
|
|
|
|
|
|
|
public boolean isCellEditable(int row, int column) { |
|
|
public boolean isCellEditable(int row, int column) { |
|
|
return columnEditables[column]; |
|
|
return columnEditables[column]; |
|
|
} |
|
|
} |
|
@ -253,6 +245,7 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
expensesDisplay.setText(setExpensesView()); |
|
|
expensesDisplay.setText(setExpensesView()); |
|
|
balance = Integer.parseInt(text1.getText()) - Integer.parseInt(text2.getText()); |
|
|
balance = Integer.parseInt(text1.getText()) - Integer.parseInt(text2.getText()); |
|
|
balanceDisplay.setText(setBalanceView()); |
|
|
balanceDisplay.setText(setBalanceView()); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
@ -267,9 +260,9 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
budgetDispaly.setText(null); |
|
|
budgetDispaly.setText(null); |
|
|
expensesDisplay.setText(null); |
|
|
expensesDisplay.setText(null); |
|
|
balanceDisplay.setText(null); |
|
|
balanceDisplay.setText(null); |
|
|
|
|
|
((DefaultTableModel)myTable.getModel()).setRowCount(0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static String setBudgetView() { |
|
|
public static String setBudgetView() { |
|
|
String result = budget + " €"; |
|
|
String result = budget + " €"; |
|
|
return result; |
|
|
return result; |
|
@ -284,4 +277,5 @@ public class MeinGui extends JFrame implements ActionListener { |
|
|
String result = balance + " €"; |
|
|
String result = balance + " €"; |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |