New: finished sparkontoframe

gui
Caner 2022-12-04 00:18:39 +01:00
parent e2666fb5a2
commit bc1c85afcd
4 changed files with 112 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import de.hs_mannheim.informatik.bank.gui.FehlerFrame;
import de.hs_mannheim.informatik.bank.gui.HauptmenüFrame;
import de.hs_mannheim.informatik.bank.gui.KontoauszugFrame;
import de.hs_mannheim.informatik.bank.gui.LoginFrame;
import de.hs_mannheim.informatik.bank.gui.SaldoFrame;
public class Main {
@ -17,8 +18,7 @@ public class Main {
//AuswahlmenüSparkontoFrame asf = new AuswahlmenüSparkontoFrame(bs);
KontoauszugFrame kaf = new KontoauszugFrame(bs);
SaldoFrame sf = new SaldoFrame(bs);
}

View File

@ -91,14 +91,14 @@ public class AuswahlmenüSparkontoFrame implements ActionListener{
else if(e.getSource() == button3) {
frame.dispose();
// TODO KontoauszugFrame
KontoauszugFrame kontoauszugFrame = new KontoauszugFrame(bs);
}
else if(e.getSource() == button4) {
frame.dispose();
// TODO SaldoFrame
SaldoFrame saldoFrame = new SaldoFrame(bs);
}

View File

@ -48,12 +48,13 @@ public class KontoauszugFrame implements ActionListener{
panel.add(input);
this.output = new JTextArea();
output.setBounds(10, 50, 415, 200);
output.setBounds(10, 50, 414, 200);
output.setEditable(false);
panel.add(output);
this.button = new JButton("Kontoauszug drucken");
button.setBounds(265, 20, 160, 25);
button.addActionListener(this);
panel.add(button);
frame.setVisible(true);

View File

@ -0,0 +1,106 @@
package de.hs_mannheim.informatik.bank.gui;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import de.hs_mannheim.informatik.bank.facade.Banksystem;
public class SaldoFrame implements ActionListener {
private JPanel panel;
private JFrame frame;
private JLabel label;
private JTextField input;
private JTextField input2;
private JTextArea output;
private JButton button;
private JButton button2;
private Banksystem bs;
public SaldoFrame(Banksystem bs) {
this.bs = bs;
this.panel = new JPanel();
this.frame = new JFrame();
frame.setTitle(bs.getBankname() + " - Saldo");
frame.setSize(450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null);
frame.setResizable(false);
frame.add(panel);
panel.setLayout(null);
this.label = new JLabel("Kontonummer");
label.setBounds(10, 10, 100, 25);
panel.add(label);
this.input = new JTextField(20);
input.setBounds(100, 10, 60, 25);
panel.add(input);
this.label = new JLabel("Anzahl");
label.setBounds(10, 40, 100, 25);
panel.add(label);
this.input2 = new JTextField(20);
input2.setBounds(100, 40, 60, 25);
panel.add(input2);
this.output = new JTextArea();
output.setBounds(10, 80, 414, 170);
output.setEditable(false);
panel.add(output);
this.button = new JButton("Saldo drucken");
button.setBounds(265, 10, 160, 25);
button.addActionListener(this);
panel.add(button);
this.button2 = new JButton("Auswahlmenü");
button2.setBounds(265, 40, 160, 25);
button2.addActionListener(this);
panel.add(button2);
frame.setVisible(true);
}
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("Saldo...");
try {
if (e.getSource() == button) {
long saldo = bs.saldoBestimmen(Integer.parseInt(input.getText()), Integer.parseInt(input2.getText()));
output.append(
"Der Saldo nach " + input2.getText() + " Kontobewegungen beträgt " + (saldo / 100d) + " Euro.");
} else if (e.getSource() == button2) {
frame.dispose();
AuswahlmenüSparkontoFrame auswahlmenü = new AuswahlmenüSparkontoFrame(bs);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}