Fix: fixed existing errors with frames

gui
Caner 2022-12-05 13:46:05 +01:00
parent 0405327506
commit e54748d16f
12 changed files with 202 additions and 102 deletions

View File

@ -28,7 +28,7 @@ public class AktienAnzeigenFrame implements ActionListener {
this.frame = new JFrame(); this.frame = new JFrame();
frame.setTitle(bs.getBankname() + " - Aktien anzeigen"); frame.setTitle(bs.getBankname() + " - Aktien anzeigen");
frame.setSize(500, 500); frame.setSize(400, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null); frame.setLocationRelativeTo(null);
frame.setResizable(false); frame.setResizable(false);
@ -36,17 +36,17 @@ public class AktienAnzeigenFrame implements ActionListener {
panel.setLayout(null); panel.setLayout(null);
this.button = new JButton("Aktien anzeigen"); this.button = new JButton("Aktien anzeigen");
button.setBounds(10, 10, 100, 25); button.setBounds(10, 10, 130, 25);
button.addActionListener(this); button.addActionListener(this);
panel.add(button); panel.add(button);
this.button2 = new JButton("Zurück"); this.button2 = new JButton("Zurück");
button2.setBounds(10, 40, 100, 25); button2.setBounds(245, 10, 130, 25);
button2.addActionListener(this); button2.addActionListener(this);
panel.add(button2); panel.add(button2);
this.output = new JTextArea(); this.output = new JTextArea();
output.setBounds(10, 40, 470, 400); output.setBounds(10, 55, 365, 200);
output.setEditable(false); output.setEditable(false);
panel.add(output); panel.add(output);

View File

@ -1,6 +1,5 @@
package de.hs_mannheim.informatik.bank.gui; package de.hs_mannheim.informatik.bank.gui;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -11,9 +10,10 @@ import javax.swing.JPanel;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.JTextField; import javax.swing.JTextField;
import de.hs_mannheim.informatik.bank.domain.Kontoart;
import de.hs_mannheim.informatik.bank.facade.Banksystem; import de.hs_mannheim.informatik.bank.facade.Banksystem;
public class AktienKaufenFrame implements ActionListener{ public class AktienKaufenFrame implements ActionListener {
private JPanel panel; private JPanel panel;
private JFrame frame; private JFrame frame;
@ -23,6 +23,8 @@ public class AktienKaufenFrame implements ActionListener{
private JLabel label4; private JLabel label4;
private JLabel label5; private JLabel label5;
private JLabel label6; private JLabel label6;
private JLabel label7;
private JLabel label8;
private JTextField input; private JTextField input;
private JTextField input2; private JTextField input2;
private JTextField input3; private JTextField input3;
@ -30,6 +32,9 @@ public class AktienKaufenFrame implements ActionListener{
private JButton button; private JButton button;
private JButton button2; private JButton button2;
private String aktienName1 = "DBK.DE";
private String aktienName2 = "DCO.DE";
private Banksystem bs; private Banksystem bs;
public AktienKaufenFrame(Banksystem bs) { public AktienKaufenFrame(Banksystem bs) {
@ -55,46 +60,54 @@ public class AktienKaufenFrame implements ActionListener{
label2.setBounds(10, 30, 200, 25); label2.setBounds(10, 30, 200, 25);
panel.add(label2); panel.add(label2);
this.label7 = new JLabel("Preis d. Aktie:" + " " + bs.getAktienPreis(aktienName1) + "€");
label7.setBounds(200, 30, 200, 25);
panel.add(label7);
this.label3 = new JLabel("2. Deere & Company (DCO.DE)"); this.label3 = new JLabel("2. Deere & Company (DCO.DE)");
label3.setBounds(10, 50, 200, 25); label3.setBounds(10, 50, 200, 25);
panel.add(label3); panel.add(label3);
this.label8 = new JLabel("Preis d. Aktie:" + " " + bs.getAktienPreis(aktienName2) + "€");
label8.setBounds(200, 50, 200, 25);
panel.add(label8);
this.label4 = new JLabel("Name d. Aktie"); this.label4 = new JLabel("Name d. Aktie");
label4.setBounds(10, 80, 200, 25); label4.setBounds(10, 85, 200, 25);
panel.add(label4); panel.add(label4);
this.input = new JTextField(20); this.input = new JTextField(20);
input.setBounds(120, 80, 80, 20); input.setBounds(120, 85, 80, 25);
panel.add(input); panel.add(input);
this.label5 = new JLabel("Anzahl"); this.label5 = new JLabel("Anzahl");
label5.setBounds(10, 110, 200, 25); label5.setBounds(10, 115, 200, 25);
panel.add(label5); panel.add(label5);
this.input2 = new JTextField(20); this.input2 = new JTextField(20);
input2.setBounds(120, 110, 80, 20); input2.setBounds(120, 115, 80, 25);
panel.add(input2); panel.add(input2);
this.label6 = new JLabel("Kontonummer"); this.label6 = new JLabel("Kontonummer");
label6.setBounds(10, 140, 200, 25); label6.setBounds(10, 145, 200, 25);
panel.add(label6); panel.add(label6);
this.input3 = new JTextField(20); this.input3 = new JTextField(20);
input3.setBounds(120, 140, 80, 20); input3.setBounds(120, 145, 80, 25);
panel.add(input3); panel.add(input3);
this.button = new JButton("Kaufen"); this.button = new JButton("Kaufen");
button.setBounds(100, 200, 80, 25); button.setBounds(250, 115, 80, 25);
button.addActionListener(this); button.addActionListener(this);
panel.add(button); panel.add(button);
this.button2 = new JButton("Zurück"); this.button2 = new JButton("Zurück");
button2.setBounds(10, 200, 80, 25); button2.setBounds(200, 415, 80, 25);
button2.addActionListener(this); button2.addActionListener(this);
panel.add(button2); panel.add(button2);
this.output = new JTextArea(); this.output = new JTextArea();
output.setBounds(10, 250, 400, 200); output.setBounds(40, 200, 400, 200);
panel.add(output); panel.add(output);
frame.setVisible(true); frame.setVisible(true);
@ -108,14 +121,13 @@ public class AktienKaufenFrame implements ActionListener{
if (e.getSource() == button) { if (e.getSource() == button) {
output.append("Preise 1: " + bs.getAktienPreis("DBK.DE") + ", 2: " + bs.getAktienPreis("DCO.DE"));
String aktienName = input.getText(); String aktienName = input.getText();
int anzahl = Integer.parseInt(input2.getText()); int anzahl = Integer.parseInt(input2.getText());
int kontonummer = Integer.parseInt(input3.getText()); int kontonummer = Integer.parseInt(input3.getText());
boolean erg = bs.aktienKauf(kontonummer, anzahl, aktienName); boolean erg = bs.aktienKauf(kontonummer, anzahl, aktienName);
output.append("Aktienkauf" + ((!erg)? " nicht" : "" ) + " erfolgreich. "); output.append("Aktienkauf" + ((!erg) ? " nicht" : "") + " erfolgreich. ");
} }
@ -130,8 +142,6 @@ public class AktienKaufenFrame implements ActionListener{
FehlerFrame ff = new FehlerFrame(bs); FehlerFrame ff = new FehlerFrame(bs);
} }
} }
} }

View File

@ -41,37 +41,37 @@ public class AuswahlmenüDepotFrame implements ActionListener{
panel.setLayout(null); panel.setLayout(null);
this.button = new JButton("Geld einzahlen"); this.button = new JButton("Geld einzahlen");
button.setBounds(40, 50, 300, 25); button.setBounds(40, 20, 300, 25);
button.addActionListener(this); button.addActionListener(this);
panel.add(button); panel.add(button);
this.button2 = new JButton("Geld abheben"); this.button2 = new JButton("Geld abheben");
button2.setBounds(40, 80, 300, 25); button2.setBounds(40, 50, 300, 25);
button2.addActionListener(this); button2.addActionListener(this);
panel.add(button2); panel.add(button2);
this.button3 = new JButton("Kontoauszug"); this.button3 = new JButton("Kontoauszug");
button3.setBounds(40, 110, 300, 25); button3.setBounds(40, 80, 300, 25);
button3.addActionListener(this); button3.addActionListener(this);
panel.add(button3); panel.add(button3);
this.button4 = new JButton("Saldo"); this.button4 = new JButton("Saldo");
button4.setBounds(40, 140, 300, 25); button4.setBounds(40, 110, 300, 25);
button4.addActionListener(this); button4.addActionListener(this);
panel.add(button4); panel.add(button4);
this.button5 = new JButton("Aktien kaufen"); this.button5 = new JButton("Aktien kaufen");
button5.setBounds(40, 170, 300, 25); button5.setBounds(40, 140, 300, 25);
button5.addActionListener(this); button5.addActionListener(this);
panel.add(button5); panel.add(button5);
this.button6 = new JButton("Aktien anzeigen"); this.button6 = new JButton("Aktien anzeigen");
button6.setBounds(40, 200, 300, 25); button6.setBounds(40, 170, 300, 25);
button6.addActionListener(this); button6.addActionListener(this);
panel.add(button6); panel.add(button6);
this.button7 = new JButton("Hauptmenü"); this.button7 = new JButton("Auswahlmenü");
button7.setBounds(40, 230, 300, 25); button7.setBounds(40, 200, 300, 25);
button7.addActionListener(this); button7.addActionListener(this);
panel.add(button7); panel.add(button7);
@ -130,7 +130,7 @@ public class AuswahlmenüDepotFrame implements ActionListener{
else if(e.getSource() == button7) { else if(e.getSource() == button7) {
frame.dispose(); frame.dispose();
HauptmenüFrame hauptmenüFrame = new HauptmenüFrame(bs); AuswahlmenüFrame auswahlmenüFrame = new AuswahlmenüFrame(bs);
} }

View File

@ -62,7 +62,7 @@ public class AuswahlmenüGirokontoFrame implements ActionListener {
button5.addActionListener(this); button5.addActionListener(this);
panel.add(button5); panel.add(button5);
this.button6 = new JButton("Hauptmenü"); this.button6 = new JButton("Auswahlmenü");
button6.setBounds(40, 200, 300, 25); button6.setBounds(40, 200, 300, 25);
button6.addActionListener(this); button6.addActionListener(this);
panel.add(button6); panel.add(button6);
@ -101,21 +101,21 @@ public class AuswahlmenüGirokontoFrame implements ActionListener {
else if(e.getSource() == button4) { else if(e.getSource() == button4) {
frame.dispose(); frame.dispose();
ÜberweisungsFrame überweisungsFrame = new ÜberweisungsFrame(bs); SaldoFrame saldoFrame = new SaldoFrame(bs);
} }
else if(e.getSource() == button5) { else if(e.getSource() == button5) {
frame.dispose(); frame.dispose();
SaldoFrame saldoFrame = new SaldoFrame(bs); ÜberweisungsFrame überweisungsFrame = new ÜberweisungsFrame(bs);
} }
else if(e.getSource() == button6) { else if(e.getSource() == button6) {
frame.dispose(); frame.dispose();
HauptmenüFrame hauptmenüFrame = new HauptmenüFrame(bs); AuswahlmenüFrame auswahlmenüFrame = new AuswahlmenüFrame(bs);
} }

View File

@ -57,7 +57,7 @@ public class AuswahlmenüSparkontoFrame implements ActionListener{
button4.addActionListener(this); button4.addActionListener(this);
panel.add(button4); panel.add(button4);
this.button5 = new JButton("Hauptmenü"); this.button5 = new JButton("Auswahlmenü");
button5.setBounds(40, 170, 300, 25); button5.setBounds(40, 170, 300, 25);
button5.addActionListener(this); button5.addActionListener(this);
panel.add(button5); panel.add(button5);
@ -105,7 +105,7 @@ public class AuswahlmenüSparkontoFrame implements ActionListener{
else if(e.getSource() == button5) { else if(e.getSource() == button5) {
frame.dispose(); frame.dispose();
HauptmenüFrame hauptmenüFrame = new HauptmenüFrame(bs); AuswahlmenüFrame auswahlmenüFrame = new AuswahlmenüFrame(bs);
} }

View File

@ -11,6 +11,7 @@ import java.awt.event.ActionListener;
import java.io.IOException; import java.io.IOException;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import de.hs_mannheim.informatik.bank.domain.Kontoart;
import de.hs_mannheim.informatik.bank.facade.Banksystem; import de.hs_mannheim.informatik.bank.facade.Banksystem;
public class GeldAuszahlenFrame implements ActionListener{ public class GeldAuszahlenFrame implements ActionListener{
@ -37,51 +38,42 @@ public class GeldAuszahlenFrame implements ActionListener{
this.frame = new JFrame(); this.frame = new JFrame();
frame.setTitle(bs.getBankname() + " - Geld auszahlen"); frame.setTitle(bs.getBankname() + " - Geld auszahlen");
frame.setSize(500, 400); frame.setSize(400, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null); frame.setLocationRelativeTo(null);
frame.setResizable(false); frame.setResizable(false);
frame.add(panel); frame.add(panel);
panel.setLayout(null); panel.setLayout(null);
this.button = new JButton("Kontostand");
button.setBounds(10, 10, 120, 25);
button.addActionListener(this);
panel.add(button);
this.output = new JTextArea();
output.setBounds(180, 10, 250, 25);
output.setEditable(false);
panel.add(output);
this.label = new JLabel("Kontonummer"); this.label = new JLabel("Kontonummer");
label.setBounds(10, 50, 100, 25); label.setBounds(10, 10, 100, 25);
panel.add(label); panel.add(label);
this.input = new JTextField(); this.input = new JTextField();
input.setBounds(180, 50, 250, 25); input.setBounds(140, 10, 120, 25);
panel.add(input); panel.add(input);
this.label2 = new JLabel("Betrag (€)"); this.label2 = new JLabel("Betrag (€)");
label2.setBounds(10, 80, 100, 25); label2.setBounds(10, 40, 100, 25);
panel.add(label2); panel.add(label2);
this.input2 = new JTextField(); this.input2 = new JTextField();
input2.setBounds(180, 80, 250, 25); input2.setBounds(140, 40, 120, 25);
panel.add(input2); panel.add(input2);
this.output2 = new JTextArea(); this.output2 = new JTextArea();
output2.setBounds(25, 170, 435, 165); output2.setBounds(70, 120, 250, 100);
output2.setEditable(false); output2.setEditable(false);
panel.add(output2); panel.add(output2);
this.button2 = new JButton("Geld auszahlen"); this.button2 = new JButton("Geld auszahlen");
button2.setBounds(10, 120, 120, 25); button2.setBounds(140, 85, 120, 25);
button2.addActionListener(this); button2.addActionListener(this);
panel.add(button2); panel.add(button2);
this.button3 = new JButton("Auswahlmenü"); this.button3 = new JButton("Zurück");
button3.setBounds(355, 120, 120, 25); button3.setBounds(140, 230, 120, 25);
button3.addActionListener(this); button3.addActionListener(this);
panel.add(button3); panel.add(button3);
@ -128,8 +120,31 @@ public class GeldAuszahlenFrame implements ActionListener{
else if(e.getSource() == button3) { else if(e.getSource() == button3) {
if(bs.checkKontoart(Integer.parseInt(input.getText())) == Kontoart.Sparkonto) {
frame.dispose(); frame.dispose();
AuswahlmenüFrame amf = new AuswahlmenüFrame(bs); AuswahlmenüSparkontoFrame asf = new AuswahlmenüSparkontoFrame(bs);
}
else if(bs.checkKontoart(Integer.parseInt(input.getText())) == Kontoart.Girokonto) {
frame.dispose();
AuswahlmenüGirokontoFrame agf = new AuswahlmenüGirokontoFrame(bs);
}
else if(bs.checkKontoart(Integer.parseInt(input.getText())) == Kontoart.Depot) {
frame.dispose();
AuswahlmenüDepotFrame adf = new AuswahlmenüDepotFrame(bs);
} else {
frame.dispose();
FehlerFrame ff = new FehlerFrame(bs);
}
} }

View File

@ -11,6 +11,7 @@ import java.awt.event.ActionListener;
import java.io.IOException; import java.io.IOException;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import de.hs_mannheim.informatik.bank.domain.Kontoart;
import de.hs_mannheim.informatik.bank.facade.Banksystem; import de.hs_mannheim.informatik.bank.facade.Banksystem;
public class GeldEinzahlenFrame implements ActionListener { public class GeldEinzahlenFrame implements ActionListener {
@ -69,7 +70,7 @@ public class GeldEinzahlenFrame implements ActionListener {
button.setBounds(40, 305, 300, 25); button.setBounds(40, 305, 300, 25);
panel.add(button); panel.add(button);
this.button2 = new JButton("Auswahlmenü"); this.button2 = new JButton("Zurück");
button2.addActionListener(this); button2.addActionListener(this);
button2.setBounds(40, 410, 300, 25); button2.setBounds(40, 410, 300, 25);
panel.add(button2); panel.add(button2);
@ -100,8 +101,31 @@ public class GeldEinzahlenFrame implements ActionListener {
else if (e.getSource() == button2) { else if (e.getSource() == button2) {
if(bs.checkKontoart(Integer.parseInt(input.getText())) == Kontoart.Sparkonto) {
frame.dispose(); frame.dispose();
AuswahlmenüFrame amf = new AuswahlmenüFrame(bs); AuswahlmenüSparkontoFrame asf = new AuswahlmenüSparkontoFrame(bs);
}
else if(bs.checkKontoart(Integer.parseInt(input.getText())) == Kontoart.Girokonto) {
frame.dispose();
AuswahlmenüGirokontoFrame agf = new AuswahlmenüGirokontoFrame(bs);
}
else if(bs.checkKontoart(Integer.parseInt(input.getText())) == Kontoart.Depot) {
frame.dispose();
AuswahlmenüDepotFrame adf = new AuswahlmenüDepotFrame(bs);
} else {
frame.dispose();
FehlerFrame ff = new FehlerFrame(bs);
}
} }

View File

@ -16,6 +16,7 @@ public class HauptmenüFrame implements ActionListener {
private JFrame frame; private JFrame frame;
private JButton button; private JButton button;
private JButton button2; private JButton button2;
private JButton button3;
private JLabel label; private JLabel label;
private JLabel label2; private JLabel label2;
@ -29,7 +30,7 @@ public class HauptmenüFrame implements ActionListener {
this.frame = new JFrame(); this.frame = new JFrame();
frame.setTitle(bs.getBankname() + " - Hauptmenü"); frame.setTitle(bs.getBankname() + " - Hauptmenü");
frame.setSize(300, 200); frame.setSize(300, 250);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocationRelativeTo(null); frame.setLocationRelativeTo(null);
frame.setResizable(false); frame.setResizable(false);
@ -45,15 +46,20 @@ public class HauptmenüFrame implements ActionListener {
panel.add(label2); panel.add(label2);
this.button = new JButton("Neuen Kunden anlegen"); this.button = new JButton("Neuen Kunden anlegen");
button.setBounds(1, 80, 300, 25); button.setBounds(15, 80, 250, 25);
button.addActionListener(this); button.addActionListener(this);
panel.add(button); panel.add(button);
this.button2 = new JButton("Bei bestehendem Kunden einloggen"); this.button2 = new JButton("Bei Kunden einloggen");
button2.setBounds(1, 110, 300, 25); button2.setBounds(15, 110, 250, 25);
button2.addActionListener(this); button2.addActionListener(this);
panel.add(button2); panel.add(button2);
this.button3 = new JButton("Beenden");
button3.setBounds(15, 140, 250, 25);
button3.addActionListener(this);
panel.add(button3);
frame.setVisible(true); frame.setVisible(true);
} }
@ -77,6 +83,12 @@ public class HauptmenüFrame implements ActionListener {
} }
else if (e.getSource() == button3) {
frame.dispose();
}
} }
} }

View File

@ -74,7 +74,7 @@ public class KontoAuswahlFrame implements ActionListener{
} else if(bs.checkKontoart(Integer.parseInt(input.getText())) == Kontoart.Depot) { } else if(bs.checkKontoart(Integer.parseInt(input.getText())) == Kontoart.Depot) {
frame.dispose(); frame.dispose();
// TODO Auswahl Depot AuswahlmenüDepotFrame auswahlmenüDepotFrame = new AuswahlmenüDepotFrame(bs);
} else { } else {

View File

@ -10,9 +10,10 @@ import javax.swing.JTextField;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import de.hs_mannheim.informatik.bank.domain.Kontoart;
import de.hs_mannheim.informatik.bank.facade.Banksystem; import de.hs_mannheim.informatik.bank.facade.Banksystem;
public class KontoauszugFrame implements ActionListener{ public class KontoauszugFrame implements ActionListener {
private JPanel panel; private JPanel panel;
private JFrame frame; private JFrame frame;
@ -24,8 +25,7 @@ public class KontoauszugFrame implements ActionListener{
private Banksystem bs; private Banksystem bs;
public KontoauszugFrame(Banksystem bs) {
public KontoauszugFrame(Banksystem bs){
this.bs = bs; this.bs = bs;
@ -49,7 +49,7 @@ public class KontoauszugFrame implements ActionListener{
panel.add(input); panel.add(input);
this.output = new JTextArea(); this.output = new JTextArea();
output.setBounds(10, 50, 414, 200); output.setBounds(10, 50, 414, 150);
output.setEditable(false); output.setEditable(false);
panel.add(output); panel.add(output);
@ -59,7 +59,7 @@ public class KontoauszugFrame implements ActionListener{
panel.add(button); panel.add(button);
this.button2 = new JButton("Zurück"); this.button2 = new JButton("Zurück");
button2.setBounds(10, 260, 100, 25); button2.setBounds(170, 220, 100, 25);
button2.addActionListener(this); button2.addActionListener(this);
panel.add(button2); panel.add(button2);
@ -67,7 +67,6 @@ public class KontoauszugFrame implements ActionListener{
} }
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -75,13 +74,13 @@ public class KontoauszugFrame implements ActionListener{
if (e.getSource() == button) { if (e.getSource() == button) {
if(e.getSource() == button){ if (e.getSource() == button) {
String[] kontoauszug = bs.erstelleKontoauszug(Integer.parseInt(input.getText())); String[] kontoauszug = bs.erstelleKontoauszug(Integer.parseInt(input.getText()));
if(kontoauszug.length > 0) { if (kontoauszug.length > 0) {
for(String ka : kontoauszug) { for (String ka : kontoauszug) {
output.append(ka + "\n"); output.append(ka + "\n");
@ -97,10 +96,26 @@ public class KontoauszugFrame implements ActionListener{
} }
else if(e.getSource() == button2){ else if (e.getSource() == button2) {
if (bs.checkKontoart(Integer.parseInt(input.getText())) == Kontoart.Sparkonto) {
frame.dispose(); frame.dispose();
AuswahlmenüFrame amf = new AuswahlmenüFrame(bs); AuswahlmenüSparkontoFrame asf = new AuswahlmenüSparkontoFrame(bs);
}
else if (bs.checkKontoart(Integer.parseInt(input.getText())) == Kontoart.Girokonto) {
frame.dispose();
AuswahlmenüGirokontoFrame agf = new AuswahlmenüGirokontoFrame(bs);
}
else if (bs.checkKontoart(Integer.parseInt(input.getText())) == Kontoart.Depot) {
frame.dispose();
AuswahlmenüDepotFrame adf = new AuswahlmenüDepotFrame(bs);
} else { } else {
@ -111,4 +126,5 @@ public class KontoauszugFrame implements ActionListener{
} }
}
} }

View File

@ -10,6 +10,7 @@ import javax.swing.JTextField;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import de.hs_mannheim.informatik.bank.domain.Kontoart;
import de.hs_mannheim.informatik.bank.facade.Banksystem; import de.hs_mannheim.informatik.bank.facade.Banksystem;
public class SaldoFrame implements ActionListener { public class SaldoFrame implements ActionListener {
@ -66,7 +67,7 @@ public class SaldoFrame implements ActionListener {
button.addActionListener(this); button.addActionListener(this);
panel.add(button); panel.add(button);
this.button2 = new JButton("Auswahlmenü"); this.button2 = new JButton("Zurück");
button2.setBounds(265, 40, 160, 25); button2.setBounds(265, 40, 160, 25);
button2.addActionListener(this); button2.addActionListener(this);
panel.add(button2); panel.add(button2);
@ -91,8 +92,31 @@ public class SaldoFrame implements ActionListener {
} else if (e.getSource() == button2) { } else if (e.getSource() == button2) {
if (bs.checkKontoart(Integer.parseInt(input.getText())) == Kontoart.Sparkonto) {
frame.dispose(); frame.dispose();
AuswahlmenüSparkontoFrame auswahlmenü = new AuswahlmenüSparkontoFrame(bs); AuswahlmenüSparkontoFrame asf = new AuswahlmenüSparkontoFrame(bs);
}
else if (bs.checkKontoart(Integer.parseInt(input.getText())) == Kontoart.Girokonto) {
frame.dispose();
AuswahlmenüGirokontoFrame agf = new AuswahlmenüGirokontoFrame(bs);
}
else if (bs.checkKontoart(Integer.parseInt(input.getText())) == Kontoart.Depot) {
frame.dispose();
AuswahlmenüDepotFrame adf = new AuswahlmenüDepotFrame(bs);
} else {
frame.dispose();
FehlerFrame ff = new FehlerFrame(bs);
}
} }

View File

@ -10,10 +10,10 @@ import javax.swing.JPanel;
import javax.swing.JTextArea; import javax.swing.JTextArea;
import javax.swing.JTextField; import javax.swing.JTextField;
import de.hs_mannheim.informatik.bank.domain.Kontoart;
import de.hs_mannheim.informatik.bank.facade.Banksystem; import de.hs_mannheim.informatik.bank.facade.Banksystem;
public class ÜberweisungsFrame implements ActionListener {
public class ÜberweisungsFrame implements ActionListener{
private JPanel panel; private JPanel panel;
private JFrame frame; private JFrame frame;
@ -97,8 +97,6 @@ public class ÜberweisungsFrame implements ActionListener{
} }
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -113,7 +111,8 @@ public class ÜberweisungsFrame implements ActionListener{
double betrag = Double.parseDouble(input3.getText()); double betrag = Double.parseDouble(input3.getText());
String verwendungszweck = input4.getText(); String verwendungszweck = input4.getText();
boolean erfolg = bs.überweisungBeauftragen(startkonto, zielkonto, (long) (betrag * 100), verwendungszweck); boolean erfolg = bs.überweisungBeauftragen(startkonto, zielkonto, (long) (betrag * 100),
verwendungszweck);
output.append("Überweisung" + ((!erfolg) ? " nicht" : "") + " erfolgreich ausgeführt."); output.append("Überweisung" + ((!erfolg) ? " nicht" : "") + " erfolgreich ausgeführt.");
@ -131,7 +130,7 @@ public class ÜberweisungsFrame implements ActionListener{
else if (e.getSource() == button2) { else if (e.getSource() == button2) {
frame.dispose(); frame.dispose();
AuswahlmenüGirokontoFrame amgf = new AuswahlmenüGirokontoFrame(bs); AuswahlmenüGirokontoFrame amgk = new AuswahlmenüGirokontoFrame(bs);
} else { } else {