Browse Source

Hinzufügen Arraylist Expenses mit Methode Add und Return

Eduard2
eduardD 5 years ago
parent
commit
950cfee86e
  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. 113
      Budget Projekt/src/MeinBudgetView/MeinGui.java
  5. 7
      Hinweis El Boukhari.txt

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

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

BIN
Budget Projekt/bin/MeinBudgetView/MeinGui.class

113
Budget Projekt/src/MeinBudgetView/MeinGui.java

@ -20,6 +20,14 @@ 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 {
@ -38,7 +46,18 @@ 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.
@ -69,8 +88,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.setToolTipText("");
berechne.setBounds(78, 281, 110, 23); berechne.setBounds(78, 281, 110, 23);
berechne.setToolTipText("");
contentPane.add(berechne); contentPane.add(berechne);
this.senden = new JButton("Senden"); this.senden = new JButton("Senden");
@ -88,16 +107,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.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14));
budgetEingeben.setBounds(10, 72, 110, 20); budgetEingeben.setBounds(10, 72, 110, 20);
budgetEingeben.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14));
contentPane.add(budgetEingeben); contentPane.add(budgetEingeben);
JLabel labelBudget = new JLabel("Budget"); JLabel labelBudget = new JLabel("Budget");
@ -113,70 +132,103 @@ 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.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14));
budgetAusgeben.setBounds(10, 185, 63, 14); budgetAusgeben.setBounds(10, 185, 63, 14);
budgetAusgeben.setFont(new Font("Estrangelo Edessa", Font.BOLD, 14));
contentPane.add(budgetAusgeben); contentPane.add(budgetAusgeben);
this.leeren = new JLabel("Eintr\u00E4ge leeren");
this.leeren = new JLabel("Leeren");
leeren.setBounds(317, 253, 115, 14);
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(368, 273, 89, 23);
loeschen.setBounds(301, 281, 89, 23);
contentPane.add(loeschen); contentPane.add(loeschen);
this.exit = new JButton("Exit\r\n"); this.exit = new JButton("Exit\r\n");
exit.setBounds(494, 273, 95, 23);
exit.setBounds(477, 281, 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.setFont(new Font("Tahoma", Font.BOLD, 12));
budgetDispaly.setBounds(255, 82, 86, 14); budgetDispaly.setBounds(255, 82, 86, 14);
budgetDispaly.setFont(new Font("Tahoma", Font.BOLD, 12));
contentPane.add(budgetDispaly); contentPane.add(budgetDispaly);
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); expensesDisplay.setBounds(390, 82, 110, 14);
expensesDisplay.setFont(new Font("Tahoma", Font.BOLD, 12));
contentPane.add(expensesDisplay); contentPane.add(expensesDisplay);
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); balanceDisplay.setBounds(543, 82, 85, 14);
balanceDisplay.setFont(new Font("Tahoma", Font.BOLD, 12));
contentPane.add(balanceDisplay); contentPane.add(balanceDisplay);
textExpensesName = new JTextField(); textExpensesName = new JTextField();
textExpensesName.setToolTipText("");
textExpensesName.setBounds(60, 221, 128, 20); textExpensesName.setBounds(60, 221, 128, 20);
textExpensesName.setToolTipText("");
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);
@ -206,8 +258,11 @@ 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())});
} }
public void exitButton() { public void exitButton() {
@ -215,14 +270,15 @@ public class MeinGui extends JFrame implements ActionListener {
} }
public static void leerButton() { public static void leerButton() {
text1.setText("");
text2.setText("");
budgetDispaly.setText("");
expensesDisplay.setText("");
balanceDisplay.setText("");
text1.setText(null);
text2.setText(null);
budgetDispaly.setText(null);
expensesDisplay.setText(null);
balanceDisplay.setText(null);
textExpensesName.setText(null);
((DefaultTableModel)myTable.getModel()).setRowCount(0);
} }
public static String setBudgetView() { public static String setBudgetView() {
String result = Calculations.getBudget() + " �"; String result = Calculations.getBudget() + " �";
return result; return result;
@ -236,5 +292,6 @@ public class MeinGui extends JFrame implements ActionListener {
public static String setBalanceView() { public static String setBalanceView() {
String result = Calculations.getBalance() + " �"; String result = Calculations.getBalance() + " �";
return result; return result;
}
}
} }

7
Hinweis El Boukhari.txt

@ -1,2 +1,5 @@
Ich möchte hier darauf hinweisen, dass ich sowohl von meinem git Bash(User: Adah Boukhari) als auch direkt auf der Webseite(Mohamed El Boukhari) pushen werde.
Vielen Dank.
Ich möchte hier darauf hinweisen, dass ich meistens von meinem git Bash(User: Adah Boukhari) pushen werde.
Name: Mohamed El Boukhari
Matrikel-Nr: 344691
fdlt3054
Loading…
Cancel
Save