Fix: added buttons to missing frames

gui
Caner Aliji 2022-12-04 17:11:42 +01:00
parent 1bbdf7aea5
commit 0405327506
4 changed files with 96 additions and 24 deletions

View File

@ -15,6 +15,7 @@ public class AktienAnzeigenFrame implements ActionListener {
private JPanel panel; private JPanel panel;
private JFrame frame; private JFrame frame;
private JButton button; private JButton button;
private JButton button2;
private JTextArea output; private JTextArea output;
private Banksystem bs; private Banksystem bs;
@ -39,6 +40,11 @@ public class AktienAnzeigenFrame implements ActionListener {
button.addActionListener(this); button.addActionListener(this);
panel.add(button); panel.add(button);
this.button2 = new JButton("Zurück");
button2.setBounds(10, 40, 100, 25);
button2.addActionListener(this);
panel.add(button2);
this.output = new JTextArea(); this.output = new JTextArea();
output.setBounds(10, 40, 470, 400); output.setBounds(10, 40, 470, 400);
output.setEditable(false); output.setEditable(false);
@ -53,7 +59,7 @@ public class AktienAnzeigenFrame implements ActionListener {
System.out.println("Aktien anzeigen..."); System.out.println("Aktien anzeigen...");
try { if (e.getSource() == button) {
String[] aktien = bs.getAktienliste(); String[] aktien = bs.getAktienliste();
@ -70,8 +76,19 @@ public class AktienAnzeigenFrame implements ActionListener {
} }
} catch (Exception ex) {
ex.printStackTrace(); }
else if (e.getSource() == button2) {
frame.dispose();
AuswahlmenüDepotFrame amdf = new AuswahlmenüDepotFrame(bs);
} else {
frame.dispose();
FehlerFrame ff = new FehlerFrame(bs);
} }
} }

View File

@ -28,6 +28,7 @@ public class AktienKaufenFrame implements ActionListener{
private JTextField input3; private JTextField input3;
private JTextArea output; private JTextArea output;
private JButton button; private JButton button;
private JButton button2;
private Banksystem bs; private Banksystem bs;
@ -87,6 +88,11 @@ public class AktienKaufenFrame implements ActionListener{
button.addActionListener(this); button.addActionListener(this);
panel.add(button); panel.add(button);
this.button2 = new JButton("Zurück");
button2.setBounds(10, 200, 80, 25);
button2.addActionListener(this);
panel.add(button2);
this.output = new JTextArea(); this.output = new JTextArea();
output.setBounds(10, 250, 400, 200); output.setBounds(10, 250, 400, 200);
panel.add(output); panel.add(output);
@ -100,7 +106,7 @@ public class AktienKaufenFrame implements ActionListener{
System.out.println("Aktien kaufen..."); System.out.println("Aktien kaufen...");
try { if (e.getSource() == button) {
output.append("Preise 1: " + bs.getAktienPreis("DBK.DE") + ", 2: " + bs.getAktienPreis("DCO.DE")); output.append("Preise 1: " + bs.getAktienPreis("DBK.DE") + ", 2: " + bs.getAktienPreis("DCO.DE"));
@ -111,10 +117,21 @@ public class AktienKaufenFrame implements ActionListener{
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. ");
} catch (Exception ex) {
ex.printStackTrace();
} }
else if (e.getSource() == button2) {
frame.dispose();
AuswahlmenüDepotFrame amdf = new AuswahlmenüDepotFrame(bs);
} else {
frame.dispose();
FehlerFrame ff = new FehlerFrame(bs);
}
} }
} }

View File

@ -20,6 +20,7 @@ public class KontoauszugFrame implements ActionListener{
private JTextField input; private JTextField input;
private JTextArea output; private JTextArea output;
private JButton button; private JButton button;
private JButton button2;
private Banksystem bs; private Banksystem bs;
@ -57,6 +58,11 @@ public class KontoauszugFrame implements ActionListener{
button.addActionListener(this); button.addActionListener(this);
panel.add(button); panel.add(button);
this.button2 = new JButton("Zurück");
button2.setBounds(10, 260, 100, 25);
button2.addActionListener(this);
panel.add(button2);
frame.setVisible(true); frame.setVisible(true);
} }
@ -67,7 +73,7 @@ public class KontoauszugFrame implements ActionListener{
System.out.println("Kontoauszug drucken..."); System.out.println("Kontoauszug drucken...");
try { if (e.getSource() == button) {
if(e.getSource() == button){ if(e.getSource() == button){
@ -89,8 +95,18 @@ public class KontoauszugFrame implements ActionListener{
} }
} catch (Exception ex) { }
ex.printStackTrace();
else if(e.getSource() == button2){
frame.dispose();
AuswahlmenüFrame amf = new AuswahlmenüFrame(bs);
} else {
frame.dispose();
FehlerFrame ff = new FehlerFrame(bs);
} }
} }

View File

@ -27,6 +27,7 @@ public class ÜberweisungsFrame implements ActionListener{
private JTextField input4; private JTextField input4;
private JTextArea output; private JTextArea output;
private JButton button; private JButton button;
private JButton button2;
private Banksystem bs; private Banksystem bs;
@ -87,6 +88,11 @@ public class ÜberweisungsFrame implements ActionListener{
button.addActionListener(this); button.addActionListener(this);
panel.add(button); panel.add(button);
this.button2 = new JButton("Zurück");
button2.setBounds(40, 310, 300, 25);
button2.addActionListener(this);
panel.add(button2);
frame.setVisible(true); frame.setVisible(true);
} }
@ -98,6 +104,8 @@ public class ÜberweisungsFrame implements ActionListener{
System.out.println("Überweisung durchführen..."); System.out.println("Überweisung durchführen...");
if (e.getSource() == button) {
try { try {
int startkonto = Integer.parseInt(input.getText()); int startkonto = Integer.parseInt(input.getText());
@ -120,4 +128,18 @@ public class ÜberweisungsFrame implements ActionListener{
} }
else if (e.getSource() == button2) {
frame.dispose();
AuswahlmenüGirokontoFrame amgf = new AuswahlmenüGirokontoFrame(bs);
} else {
frame.dispose();
FehlerFrame ff = new FehlerFrame(bs);
}
}
} }