added the ausleihen and rückgabe feature to feature1 branch
parent
ca43e912ac
commit
3f4d6fb828
|
@ -12,7 +12,8 @@ public class Bibliothek {
|
|||
static ArrayList<DVD> dvdListe = new ArrayList<>();
|
||||
static ArrayList<Brettspiel> brettspielListe = new ArrayList<>();
|
||||
static ArrayList<Videospiel> videospielListe = new ArrayList<>();
|
||||
static ArrayList<Benutzer> benutzerListe = new ArrayList<>();
|
||||
static ArrayList<Kunde> kundenListe = new ArrayList<>();
|
||||
static ArrayList<Medium> katalog = new ArrayList<>();
|
||||
|
||||
public static void makeEntries() {
|
||||
Buch b1 = new Buch("Buch1", 2000, "Autor1", "01.01.2020", 10001);
|
||||
|
@ -70,34 +71,50 @@ public class Bibliothek {
|
|||
videospielListe.add(v4);
|
||||
videospielListe.add(v5);
|
||||
|
||||
Benutzer bn1 = new Mitarbeiter(1);
|
||||
Benutzer bn2 = new Kunde(true, 2);
|
||||
Benutzer bn3 = new Kunde(true, 3);
|
||||
Benutzer bn4 = new Kunde(false, 4);
|
||||
Benutzer bn5 = new Kunde(false, 5);
|
||||
benutzerListe.add(bn1);
|
||||
benutzerListe.add(bn2);
|
||||
benutzerListe.add(bn3);
|
||||
benutzerListe.add(bn4);
|
||||
benutzerListe.add(bn5);
|
||||
//Benutzer bn1 = new Mitarbeiter(1);
|
||||
Kunde bn2 = new Kunde(true, 2);
|
||||
Kunde bn3 = new Kunde(true, 3);
|
||||
Kunde bn4 = new Kunde(false, 4);
|
||||
Kunde bn5 = new Kunde(false, 5);
|
||||
kundenListe.add(bn2);
|
||||
kundenListe.add(bn3);
|
||||
kundenListe.add(bn4);
|
||||
kundenListe.add(bn5);
|
||||
|
||||
for(Buch b: bücherListe) {
|
||||
katalog.add(b);
|
||||
}
|
||||
for(DVD d: dvdListe) {
|
||||
katalog.add(d);
|
||||
}
|
||||
for(CD c: cdListe) {
|
||||
katalog.add(c);
|
||||
}
|
||||
for(Brettspiel bs: brettspielListe) {
|
||||
katalog.add(bs);
|
||||
}
|
||||
for(Videospiel vs: videospielListe) {
|
||||
katalog.add(vs);
|
||||
}
|
||||
}
|
||||
|
||||
public static Benutzer validateLogin(int login) {
|
||||
for(Benutzer b: benutzerListe) {
|
||||
if(b.getKennnummer() == login) {
|
||||
return b;
|
||||
public static Kunde validateLogin(int login) {
|
||||
for(Kunde k: kundenListe) {
|
||||
if(k.getKennnummer() == login) {
|
||||
return k;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static int bücherLänge() {
|
||||
return bücherListe.size();
|
||||
}
|
||||
|
||||
public static ArrayList<JLabel> buchAuflisten() {
|
||||
ArrayList<JLabel> jlabelList = new ArrayList<>();
|
||||
if(bücherListe.size() == 0) {
|
||||
JLabel text = new JLabel("Keine Bücher mehr vorhanden.");
|
||||
jlabelList.add(text);
|
||||
return jlabelList;
|
||||
}
|
||||
for(Buch b: bücherListe) {
|
||||
JLabel buch = new JLabel("Titel: " + b.getTitel()
|
||||
+ ", Autor: " + b.getAutor()
|
||||
|
@ -108,12 +125,14 @@ public class Bibliothek {
|
|||
return jlabelList;
|
||||
}
|
||||
|
||||
public static int dvdLänge() {
|
||||
return dvdListe.size();
|
||||
}
|
||||
|
||||
public static ArrayList<JLabel> dvdAuflisten() {
|
||||
ArrayList<JLabel> jlabelList = new ArrayList<>();
|
||||
if(dvdListe.size() == 0) {
|
||||
JLabel text = new JLabel("Keine DVDs mehr vorhanden.");
|
||||
jlabelList.add(text);
|
||||
return jlabelList;
|
||||
}
|
||||
for(DVD d: dvdListe) {
|
||||
JLabel dvd = new JLabel("Titel: " + d.getTitel()
|
||||
+ ", Jahr: " + d.getJahr()
|
||||
|
@ -123,12 +142,13 @@ public class Bibliothek {
|
|||
return jlabelList;
|
||||
}
|
||||
|
||||
public static int cdLänge() {
|
||||
return cdListe.size();
|
||||
}
|
||||
|
||||
public static ArrayList<JLabel> cdAuflisten() {
|
||||
ArrayList<JLabel> jlabelList = new ArrayList<>();
|
||||
if(cdListe.size() == 0) {
|
||||
JLabel text = new JLabel("Keine CDs mehr vorhanden.");
|
||||
jlabelList.add(text);
|
||||
return jlabelList;
|
||||
}
|
||||
for(CD c: cdListe) {
|
||||
JLabel cd = new JLabel("Titel: " + c.getTitel()
|
||||
+ ", Jahr: " + c.getJahr()
|
||||
|
@ -138,12 +158,13 @@ public class Bibliothek {
|
|||
return jlabelList;
|
||||
}
|
||||
|
||||
public static int bsLänge() {
|
||||
return brettspielListe.size();
|
||||
}
|
||||
|
||||
public static ArrayList<JLabel> bsAuflisten() {
|
||||
ArrayList<JLabel> jlabelList = new ArrayList<>();
|
||||
if(brettspielListe.size() == 0) {
|
||||
JLabel text = new JLabel("Keine Brettspiele mehr vorhanden.");
|
||||
jlabelList.add(text);
|
||||
return jlabelList;
|
||||
}
|
||||
for(Brettspiel bs: brettspielListe) {
|
||||
JLabel bsp = new JLabel("Titel: " + bs.getTitel()
|
||||
+ ", Jahr: " + bs.getJahr()
|
||||
|
@ -153,12 +174,13 @@ public class Bibliothek {
|
|||
return jlabelList;
|
||||
}
|
||||
|
||||
public static int vsLänge() {
|
||||
return videospielListe.size();
|
||||
}
|
||||
|
||||
public static ArrayList<JLabel> vsAuflisten() {
|
||||
ArrayList<JLabel> jlabelList = new ArrayList<>();
|
||||
if(videospielListe.size() == 0) {
|
||||
JLabel text = new JLabel("Keine Videospiele mehr vorhanden.");
|
||||
jlabelList.add(text);
|
||||
return jlabelList;
|
||||
}
|
||||
for(Videospiel v: videospielListe) {
|
||||
JLabel vsp = new JLabel("Titel: " + v.getTitel()
|
||||
+ ", Jahr: " + v.getJahr()
|
||||
|
@ -168,27 +190,135 @@ public class Bibliothek {
|
|||
return jlabelList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static ArrayList<JLabel> ausgelieheneListe(Kunde k) {
|
||||
ArrayList<JLabel> jlabelList = new ArrayList<>();
|
||||
for(Medium m: k.returnAusgelieheneMedien()) {
|
||||
if(m.getAutor() != null) {
|
||||
JLabel med = new JLabel("Titel: " + m.getTitel()
|
||||
ArrayList<Medium> ausgelieheneListe = k.returnAusgelieheneMedien();
|
||||
if(ausgelieheneListe.size() == 0) {
|
||||
JLabel text = new JLabel("Nichts ausgeliehen.");
|
||||
jlabelList.add(text);
|
||||
return jlabelList;
|
||||
}
|
||||
for(Medium m: ausgelieheneListe) {
|
||||
if(m.getAutor() != null) {
|
||||
JLabel med = new JLabel("Titel: " + m.getTitel()
|
||||
+ ", Autor: " + m.getAutor()
|
||||
+ ", Jahr: " + m.getJahr()
|
||||
+ ", Kennnummer: " +m.getKennnummer());
|
||||
}
|
||||
jlabelList.add(med);
|
||||
}
|
||||
if(m.getAutor() == null) {
|
||||
JLabel med = new JLabel("Titel: " + m.getTitel()
|
||||
+ ", Jahr: " + m.getJahr()
|
||||
+ ", Kennnummer: " +m.getKennnummer());
|
||||
jlabelList.add(med);
|
||||
+ ", Jahr: " + m.getJahr()
|
||||
+ ", Kennnummer: " +m.getKennnummer());
|
||||
jlabelList.add(med);
|
||||
}
|
||||
}
|
||||
}
|
||||
return jlabelList;
|
||||
}
|
||||
|
||||
public static void ausleihe(int kennnummer, Kunde k) {
|
||||
for(Medium m: katalog) {
|
||||
if(m.getKennnummer() == kennnummer) {
|
||||
String text = m.getClass().toString();
|
||||
int lastDotIndex = text.lastIndexOf(".");
|
||||
String substring = text.substring(lastDotIndex + 1);
|
||||
System.out.println(substring);
|
||||
switch (substring) {
|
||||
case "Buch":
|
||||
Buch b = (Buch) m;
|
||||
bücherListe.remove(b);
|
||||
k.addToList(b);
|
||||
break;
|
||||
case "DVD":
|
||||
DVD d = (DVD) m;
|
||||
dvdListe.remove(d);
|
||||
k.addToList(d);
|
||||
break;
|
||||
case "CD":
|
||||
CD c = (CD) m;
|
||||
cdListe.remove(c);
|
||||
k.addToList(c);
|
||||
break;
|
||||
case "Brettspiel":
|
||||
Brettspiel bs = (Brettspiel) m;
|
||||
brettspielListe.remove(bs);
|
||||
k.addToList(bs);
|
||||
break;
|
||||
case "Videospiel":
|
||||
Videospiel vs = (Videospiel) m;
|
||||
videospielListe.remove(vs);
|
||||
k.addToList(vs);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void rückgabe(int kennnummer, Kunde k) {
|
||||
for(Medium m: katalog) {
|
||||
if(m.getKennnummer() == kennnummer) {
|
||||
String text = m.getClass().toString();
|
||||
int lastDotIndex = text.lastIndexOf(".");
|
||||
String substring = text.substring(lastDotIndex + 1);
|
||||
System.out.println(substring);
|
||||
switch (substring) {
|
||||
case "Buch":
|
||||
Buch b = (Buch) m;
|
||||
bücherListe.add(b);
|
||||
k.removeFromList(m);
|
||||
break;
|
||||
case "DVD":
|
||||
DVD d = (DVD) m;
|
||||
dvdListe.add(d);
|
||||
k.removeFromList(m);
|
||||
break;
|
||||
case "CD":
|
||||
CD c = (CD) m;
|
||||
cdListe.add(c);
|
||||
k.removeFromList(m);
|
||||
break;
|
||||
case "Brettspiel":
|
||||
Brettspiel bs = (Brettspiel) m;
|
||||
brettspielListe.add(bs);
|
||||
k.removeFromList(m);
|
||||
break;
|
||||
case "Videospiel":
|
||||
Videospiel vs = (Videospiel) m;
|
||||
videospielListe.add(vs);
|
||||
k.removeFromList(m);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static int bücherLänge() {
|
||||
return bücherListe.size();
|
||||
}
|
||||
|
||||
public static int dvdLänge() {
|
||||
return dvdListe.size();
|
||||
}
|
||||
|
||||
public static int cdLänge() {
|
||||
return cdListe.size();
|
||||
}
|
||||
|
||||
public static int bsLänge() {
|
||||
return brettspielListe.size();
|
||||
}
|
||||
|
||||
public static int vsLänge() {
|
||||
return videospielListe.size();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,4 +31,9 @@ public class Kunde extends Benutzer {
|
|||
public int ausgelieheneMedienLänge() {
|
||||
return ausgelieheneMedien.size();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeFromList(Medium m) {
|
||||
ausgelieheneMedien.remove(m);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ abstract class Medium {
|
|||
abstract public int getJahr();
|
||||
abstract public String getDatum();
|
||||
abstract public int getKennnummer();
|
||||
|
||||
public String getAutor() {
|
||||
return autor;
|
||||
}
|
||||
|
@ -58,12 +59,14 @@ class DVD extends Medium{
|
|||
private int erscheinungsjahr;
|
||||
private String fälligkeitsDatum;
|
||||
private int kennnummer;
|
||||
private String autor;
|
||||
|
||||
public DVD(String titel, int erscheinungsjahr, String fälligkeitsDatum, int kennnummer) {
|
||||
this.titel = titel;
|
||||
this.erscheinungsjahr = erscheinungsjahr;
|
||||
this.fälligkeitsDatum = fälligkeitsDatum;
|
||||
this.kennnummer = kennnummer;
|
||||
this.autor = null;
|
||||
}
|
||||
|
||||
public String getTitel() {
|
||||
|
@ -74,6 +77,10 @@ class DVD extends Medium{
|
|||
return erscheinungsjahr;
|
||||
}
|
||||
|
||||
public String getAutor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getDatum() {
|
||||
return fälligkeitsDatum;
|
||||
}
|
||||
|
@ -88,12 +95,14 @@ class CD extends Medium{
|
|||
private int erscheinungsjahr;
|
||||
private String fälligkeitsDatum;
|
||||
private int kennnummer;
|
||||
private String autor;
|
||||
|
||||
public CD(String titel, int erscheinungsjahr, String fälligkeitsDatum, int kennnummer) {
|
||||
this.titel = titel;
|
||||
this.erscheinungsjahr = erscheinungsjahr;
|
||||
this.fälligkeitsDatum = fälligkeitsDatum;
|
||||
this.kennnummer = kennnummer;
|
||||
this.autor = null;
|
||||
}
|
||||
|
||||
public String getTitel() {
|
||||
|
@ -103,6 +112,9 @@ class CD extends Medium{
|
|||
public int getJahr() {
|
||||
return erscheinungsjahr;
|
||||
}
|
||||
public String getAutor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getDatum() {
|
||||
return fälligkeitsDatum;
|
||||
|
@ -118,12 +130,14 @@ class Brettspiel extends Medium{
|
|||
private int erscheinungsjahr;
|
||||
private String fälligkeitsDatum;
|
||||
private int kennnummer;
|
||||
private String autor;
|
||||
|
||||
public Brettspiel(String titel, int erscheinungsjahr, String fälligkeitsDatum, int kennnummer) {
|
||||
this.titel = titel;
|
||||
this.erscheinungsjahr = erscheinungsjahr;
|
||||
this.fälligkeitsDatum = fälligkeitsDatum;
|
||||
this.kennnummer = kennnummer;
|
||||
this.autor = null;
|
||||
}
|
||||
|
||||
public String getTitel() {
|
||||
|
@ -133,6 +147,9 @@ class Brettspiel extends Medium{
|
|||
public int getJahr() {
|
||||
return erscheinungsjahr;
|
||||
}
|
||||
public String getAutor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getDatum() {
|
||||
return fälligkeitsDatum;
|
||||
|
@ -148,12 +165,14 @@ class Videospiel extends Medium{
|
|||
private int erscheinungsjahr;
|
||||
private String fälligkeitsDatum;
|
||||
private int kennnummer;
|
||||
private String autor;
|
||||
|
||||
public Videospiel(String titel, int erscheinungsjahr, String fälligkeitsDatum, int kennnummer) {
|
||||
this.titel = titel;
|
||||
this.erscheinungsjahr = erscheinungsjahr;
|
||||
this.fälligkeitsDatum = fälligkeitsDatum;
|
||||
this.kennnummer = kennnummer;
|
||||
this.autor = null;
|
||||
}
|
||||
|
||||
public String getTitel() {
|
||||
|
@ -163,6 +182,9 @@ class Videospiel extends Medium{
|
|||
public int getJahr() {
|
||||
return erscheinungsjahr;
|
||||
}
|
||||
public String getAutor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getDatum() {
|
||||
return fälligkeitsDatum;
|
||||
|
|
|
@ -29,12 +29,12 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
|||
b2.addActionListener(e -> {
|
||||
String loginStr = field1.getText();
|
||||
Integer login = Integer.parseInt(loginStr);
|
||||
Benutzer b = Bibliothek.validateLogin(login);
|
||||
if(b == null) {dispose();}
|
||||
String text = b.getClass().toString();
|
||||
Kunde k = Bibliothek.validateLogin(login);
|
||||
if(k == null) {dispose();}
|
||||
String text = k.getClass().toString();
|
||||
int lastDotIndex = text.lastIndexOf(".");
|
||||
String substring = text.substring(lastDotIndex + 1);
|
||||
if(substring.equals("Kunde")) {openMainMenu(b);}
|
||||
if(substring.equals("Kunde")) {openMainMenu(k);}
|
||||
if(substring.equals("Mitarbeiter")) {openAdmin();}
|
||||
});
|
||||
bp.add(b1);
|
||||
|
@ -55,9 +55,9 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
|||
|
||||
|
||||
|
||||
public static void openMainMenu(Benutzer b) {
|
||||
JPanel mediumPanel = new JPanel(new GridLayout(8, 1, 10, 10));
|
||||
JTextField text1 = new JTextField("Nutzer: " + b.getKennnummer());
|
||||
public static void openMainMenu(Kunde k) {
|
||||
JPanel mediumPanel = new JPanel(new GridLayout(10, 1, 10, 10));
|
||||
JTextField text1 = new JTextField("Nutzer: " + k.getKennnummer());
|
||||
mediumPanel.add(text1);
|
||||
JButton b1 = new JButton("Bücher");
|
||||
b1.addActionListener(e -> bookMenu());
|
||||
|
@ -69,10 +69,14 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
|||
b4.addActionListener(e -> bsMenu());
|
||||
JButton b5 = new JButton("Videospiele");
|
||||
b5.addActionListener(e -> vsMenu());
|
||||
JButton b6 = new JButton("Meine Ausgeliehenen Medien");
|
||||
b6.addActionListener(e -> myBooks(b));
|
||||
JButton b7 = new JButton("Ausloggen");
|
||||
b7.addActionListener(e -> cl.show(mainPanel, "LoginPanel"));
|
||||
JButton b6 = new JButton("Aushleihe");
|
||||
b6.addActionListener(e -> ausleihenMenü(k));
|
||||
JButton b7 = new JButton("Rückgabe");
|
||||
b7.addActionListener(e -> rückgabeMenü(k));
|
||||
JButton b8 = new JButton("Meine Ausgeliehenen Medien");
|
||||
b8.addActionListener(e -> myBooks(k));
|
||||
JButton b9 = new JButton("Ausloggen");
|
||||
b9.addActionListener(e -> cl.show(mainPanel, "loginPanel"));
|
||||
mediumPanel.add(b1);
|
||||
mediumPanel.add(b2);
|
||||
mediumPanel.add(b3);
|
||||
|
@ -80,50 +84,73 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
|||
mediumPanel.add(b5);
|
||||
mediumPanel.add(b6);
|
||||
mediumPanel.add(b7);
|
||||
mediumPanel.add(b8);
|
||||
mediumPanel.add(b9);
|
||||
|
||||
mainPanel.add(mediumPanel, "MediumPanel");
|
||||
cl.show(mainPanel, "MediumPanel");
|
||||
mainPanel.add(mediumPanel, "mediumPanel");
|
||||
cl.show(mainPanel, "mediumPanel");
|
||||
}
|
||||
|
||||
private static void ausleihenMenü(Kunde k) {
|
||||
JPanel ausleihMenü = new JPanel(new BorderLayout());
|
||||
JLabel text1 = new JLabel("Zu ausleihende Kennnummer des Mediums eingeben:");
|
||||
JTextField inputField = new JTextField(20);
|
||||
ausleihMenü.add(text1, BorderLayout.NORTH);
|
||||
ausleihMenü.add(inputField, BorderLayout.CENTER);
|
||||
JPanel buttonGrid = new JPanel(new GridLayout(2, 1, 10,10));
|
||||
JButton b1 = new JButton("Abbrechen");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
JButton b2 = new JButton("OK");
|
||||
b2.addActionListener(e -> {
|
||||
int kennnummer = Integer.parseInt(inputField.getText());
|
||||
Bibliothek.ausleihe(kennnummer, k);
|
||||
cl.show(mainPanel, "mediumPanel");
|
||||
});
|
||||
buttonGrid.add(b1);
|
||||
buttonGrid.add(b2);
|
||||
ausleihMenü.add(buttonGrid, BorderLayout.SOUTH);
|
||||
mainPanel.add(ausleihMenü, "Ausleihen");
|
||||
cl.show(mainPanel, "Ausleihen");
|
||||
}
|
||||
|
||||
private static void rückgabeMenü(Kunde k) {
|
||||
JPanel rückgabeMenü = new JPanel(new BorderLayout());
|
||||
JLabel text1 = new JLabel("Kennnummer des Mediums zur Rückgabe eingeben:");
|
||||
JTextField inputField = new JTextField(20);
|
||||
rückgabeMenü.add(text1, BorderLayout.NORTH);
|
||||
rückgabeMenü.add(inputField, BorderLayout.CENTER);
|
||||
JPanel buttonGrid = new JPanel(new GridLayout(2, 1, 10,10));
|
||||
JButton b1 = new JButton("Abbrechen");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
JButton b2 = new JButton("OK");
|
||||
b2.addActionListener(e -> {
|
||||
int kennnummer = Integer.parseInt(inputField.getText());
|
||||
Bibliothek.rückgabe(kennnummer, k);
|
||||
cl.show(mainPanel, "mediumPanel");
|
||||
});
|
||||
buttonGrid.add(b1);
|
||||
buttonGrid.add(b2);
|
||||
rückgabeMenü.add(buttonGrid, BorderLayout.SOUTH);
|
||||
mainPanel.add(rückgabeMenü, "Rückgabe");
|
||||
cl.show(mainPanel, "Rückgabe");
|
||||
}
|
||||
|
||||
private static void bookMenu() {
|
||||
int i = Bibliothek.bücherLänge();
|
||||
if(i == 0) {
|
||||
JPanel buchMenü = new JPanel(new BorderLayout());
|
||||
JLabel text1 = new JLabel("Keine Bücher mehr vorhanden");
|
||||
buchMenü.add(text1, BorderLayout.NORTH);
|
||||
JButton b1 = new JButton("OK");
|
||||
buchMenü.add(b1, BorderLayout.SOUTH);
|
||||
mainPanel.add(buchMenü, "Bücher");
|
||||
cl.show(mainPanel, "Bücher");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
}
|
||||
if(i != 0) {
|
||||
JPanel buchMenü = new JPanel(new GridLayout(i+1, 2, 10, 10));
|
||||
ArrayList<JLabel> jlabelList = Bibliothek.buchAuflisten();
|
||||
for(JLabel j: jlabelList) {
|
||||
buchMenü.add(j);
|
||||
}
|
||||
JButton b1 = new JButton("OK");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
buchMenü.add(b1, BorderLayout.SOUTH);
|
||||
mainPanel.add(buchMenü, "Bücher");
|
||||
cl.show(mainPanel, "Bücher");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
}
|
||||
}
|
||||
|
||||
private static void dvdMenu() {
|
||||
int i = Bibliothek.dvdLänge();
|
||||
if(i == 0) {
|
||||
JPanel dvdMenü = new JPanel(new BorderLayout());
|
||||
JLabel text1 = new JLabel("Keine DVDs mehr vorhanden");
|
||||
dvdMenü.add(text1, BorderLayout.NORTH);
|
||||
JButton b1 = new JButton("OK");
|
||||
dvdMenü.add(b1, BorderLayout.SOUTH);
|
||||
mainPanel.add(dvdMenü, "DVDs");
|
||||
cl.show(mainPanel, "DVD");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
}
|
||||
if(i != 0) {
|
||||
JPanel dvdMenü = new JPanel(new GridLayout(i+1, 2, 10, 10));
|
||||
ArrayList<JLabel> jlabelList = Bibliothek.dvdAuflisten();
|
||||
for(JLabel j: jlabelList) {
|
||||
|
@ -134,22 +161,10 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
|||
dvdMenü.add(b1, BorderLayout.SOUTH);
|
||||
mainPanel.add(dvdMenü, "DVDs");
|
||||
cl.show(mainPanel, "DVDs");
|
||||
}
|
||||
}
|
||||
|
||||
private static void cdMenu() {
|
||||
int i = Bibliothek.cdLänge();
|
||||
if(i == 0) {
|
||||
JPanel cdMenü = new JPanel(new BorderLayout());
|
||||
JLabel text1 = new JLabel("Keine CDs mehr vorhanden");
|
||||
cdMenü.add(text1, BorderLayout.NORTH);
|
||||
JButton b1 = new JButton("OK");
|
||||
cdMenü.add(b1, BorderLayout.SOUTH);
|
||||
mainPanel.add(cdMenü, "CDs");
|
||||
cl.show(mainPanel, "CDs");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
}
|
||||
if(i != 0) {
|
||||
JPanel cdMenü = new JPanel(new GridLayout(i+1, 2, 10, 10));
|
||||
ArrayList<JLabel> jlabelList = Bibliothek.cdAuflisten();
|
||||
for(JLabel j: jlabelList) {
|
||||
|
@ -160,22 +175,10 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
|||
cdMenü.add(b1, BorderLayout.SOUTH);
|
||||
mainPanel.add(cdMenü, "CDs");
|
||||
cl.show(mainPanel, "CDs");
|
||||
}
|
||||
}
|
||||
|
||||
private static void bsMenu() {
|
||||
int i = Bibliothek.bsLänge();
|
||||
if(i == 0) {
|
||||
JPanel bsMenü = new JPanel(new BorderLayout());
|
||||
JLabel text1 = new JLabel("Keine Brettspiele mehr vorhanden");
|
||||
bsMenü.add(text1, BorderLayout.NORTH);
|
||||
JButton b1 = new JButton("OK");
|
||||
bsMenü.add(b1, BorderLayout.SOUTH);
|
||||
mainPanel.add(bsMenü, "Brettspiele");
|
||||
cl.show(mainPanel, "Brettspiele");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
}
|
||||
if(i != 0) {
|
||||
JPanel bsMenü = new JPanel(new GridLayout(i+1, 2, 10, 10));
|
||||
ArrayList<JLabel> jlabelList = Bibliothek.bsAuflisten();
|
||||
for(JLabel j: jlabelList) {
|
||||
|
@ -187,21 +190,10 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
|||
mainPanel.add(bsMenü, "Brettspiele");
|
||||
cl.show(mainPanel, "Brettspiele");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void vsMenu() {
|
||||
int i = Bibliothek.vsLänge();
|
||||
if(i == 0) {
|
||||
JPanel vsMenü = new JPanel(new BorderLayout());
|
||||
JLabel text1 = new JLabel("Keine Videospiele mehr vorhanden");
|
||||
vsMenü.add(text1, BorderLayout.NORTH);
|
||||
JButton b1 = new JButton("OK");
|
||||
vsMenü.add(b1, BorderLayout.SOUTH);
|
||||
mainPanel.add(vsMenü, "Videospiele");
|
||||
cl.show(mainPanel, "Videospiele");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
}
|
||||
if(i != 0) {
|
||||
JPanel vsMenü = new JPanel(new GridLayout(i+1, 2, 10, 10));
|
||||
ArrayList<JLabel> jlabelList = Bibliothek.vsAuflisten();
|
||||
for(JLabel j: jlabelList) {
|
||||
|
@ -213,33 +205,20 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
|||
mainPanel.add(vsMenü, "Videospiele");
|
||||
cl.show(mainPanel, "Videospiele");
|
||||
}
|
||||
}
|
||||
|
||||
private static void myBooks(Benutzer b) {
|
||||
Kunde k = (Kunde) b;
|
||||
|
||||
private static void myBooks(Kunde k) {
|
||||
int i = k.ausgelieheneMedienLänge();
|
||||
if(i == 0) {
|
||||
JPanel myBookMenu = new JPanel(new BorderLayout());
|
||||
JLabel text1 = new JLabel("Keine Medien ausgeliehen");
|
||||
myBookMenu.add(text1, BorderLayout.NORTH);
|
||||
JButton b1 = new JButton("OK");
|
||||
myBookMenu.add(b1, BorderLayout.SOUTH);
|
||||
mainPanel.add(myBookMenu, "AusgelieheneMedien");
|
||||
cl.show(mainPanel, "AusgelieheneMedien");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
}
|
||||
if(i != 0) {
|
||||
JPanel myBookMenu = new JPanel(new GridLayout(i+1, 2, 10, 10));
|
||||
ArrayList<JLabel> jlabelList = Bibliothek.ausgelieheneListe(k);
|
||||
for(JLabel j: jlabelList) {
|
||||
myBookMenu.add(j);
|
||||
}
|
||||
JButton b1 = new JButton("OK");
|
||||
myBookMenu.add(b1, BorderLayout.SOUTH);
|
||||
mainPanel.add(myBookMenu, "AusgelieheneMedien");
|
||||
cl.show(mainPanel, "AusgelieheneMedien");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
JPanel myBookMenu = new JPanel(new GridLayout(i+1, 2, 10, 10));
|
||||
ArrayList<JLabel> jlabelList = Bibliothek.ausgelieheneListe(k);
|
||||
for(JLabel j: jlabelList) {
|
||||
myBookMenu.add(j);
|
||||
}
|
||||
JButton b1 = new JButton("OK");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
myBookMenu.add(b1);
|
||||
mainPanel.add(myBookMenu, "AusgelieheneMedien");
|
||||
cl.show(mainPanel, "AusgelieheneMedien");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue