Browse Source

Commit_28 Funktionalitaet Table_Inhalt loeschen implementiert

Mohamed
Adah Boukhari 5 years ago
parent
commit
080f7a2cb9
  1. BIN
      Budget Projekt/bin/MeinBudgetView/MeinGui$1.class
  2. BIN
      Budget Projekt/bin/MeinBudgetView/MeinGui$2.class
  3. BIN
      Budget Projekt/bin/MeinBudgetView/MeinGui.class
  4. 50
      Budget Projekt/src/MeinBudgetView/MeinGui.java

BIN
Budget Projekt/bin/MeinBudgetView/MeinGui$1.class

BIN
Budget Projekt/bin/MeinBudgetView/MeinGui$2.class

BIN
Budget Projekt/bin/MeinBudgetView/MeinGui.class

50
Budget Projekt/src/MeinBudgetView/MeinGui.java

@ -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.
@ -178,46 +177,39 @@ public class MeinGui extends JFrame implements ActionListener {
balanceDisplay.setBounds(543, 82, 85, 14); balanceDisplay.setBounds(543, 82, 85, 14);
balanceDisplay.setFont(new Font("Tahoma", Font.BOLD, 12)); balanceDisplay.setFont(new Font("Tahoma", Font.BOLD, 12));
contentPane.add(balanceDisplay); contentPane.add(balanceDisplay);
textExpensesName = new JTextField(); textExpensesName = new JTextField();
textExpensesName.setBounds(60, 221, 128, 20); textExpensesName.setBounds(60, 221, 128, 20);
textExpensesName.setToolTipText(""); textExpensesName.setToolTipText("");
contentPane.add(textExpensesName); contentPane.add(textExpensesName);
textExpensesName.setColumns(10); textExpensesName.setColumns(10);
ausgabenName = new JLabel(" Name"); ausgabenName = new JLabel(" Name");
ausgabenName.setBounds(10, 224, 46, 14); ausgabenName.setBounds(10, 224, 46, 14);
contentPane.add(ausgabenName); contentPane.add(ausgabenName);
ausgabenBetrag = new JLabel(" Betrag"); ausgabenBetrag = new JLabel(" Betrag");
ausgabenBetrag.setBounds(10, 253, 46, 14); ausgabenBetrag.setBounds(10, 253, 46, 14);
contentPane.add(ausgabenBetrag); contentPane.add(ausgabenBetrag);
budgetBetrag = new JLabel(" Betrag"); budgetBetrag = new JLabel(" Betrag");
budgetBetrag.setBounds(10, 100, 46, 14); budgetBetrag.setBounds(10, 100, 46, 14);
contentPane.add(budgetBetrag); contentPane.add(budgetBetrag);
JScrollPane scrollPane_1 = new JScrollPane(); JScrollPane scrollPane_1 = new JScrollPane();
scrollPane_1.setBounds(323, 126, 197, 88); scrollPane_1.setBounds(323, 126, 197, 88);
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,8 +245,9 @@ 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());
}
}
} }
public void exitButton() { public void exitButton() {
@ -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;
@ -283,5 +276,6 @@ public class MeinGui extends JFrame implements ActionListener {
public static String setBalanceView() { public static String setBalanceView() {
String result = balance + " €"; String result = balance + " €";
return result; return result;
}
}
} }
Loading…
Cancel
Save