backup commit
parent
39f7af08e7
commit
f13c38e510
|
@ -5,7 +5,7 @@ import java.util.ArrayList;
|
|||
public abstract class Benutzer {
|
||||
private int kennnummer;
|
||||
abstract public int getKennnummer();
|
||||
abstract boolean istStudent();
|
||||
abstract public boolean istStudent();
|
||||
}
|
||||
|
||||
class Kunde extends Benutzer {
|
||||
|
@ -33,6 +33,10 @@ class Kunde extends Benutzer {
|
|||
public ArrayList<Medium> returnAusgeliehen(){
|
||||
return ausgelieheneMedien;
|
||||
}
|
||||
|
||||
public int ausgelieheneMedienLänge() {
|
||||
return ausgelieheneMedien.size();
|
||||
}
|
||||
}
|
||||
|
||||
class Mitarbeiter extends Benutzer {
|
||||
|
|
|
@ -7,12 +7,13 @@ import javax.swing.JLabel;
|
|||
import guiBib.*;
|
||||
|
||||
public class Bibliothek {
|
||||
static ArrayList<Buch> bücherListe = new ArrayList<>();
|
||||
static ArrayList<CD> cdListe = new ArrayList<>();
|
||||
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<Buch> bücherListe = new ArrayList<>();
|
||||
static ArrayList<CD> cdListe = new ArrayList<>();
|
||||
static ArrayList<DVD> dvdListe = new ArrayList<>();
|
||||
static ArrayList<Brettspiel> brettspielListe = new ArrayList<>();
|
||||
static ArrayList<Videospiel> videospielListe = new ArrayList<>();
|
||||
static ArrayList<Benutzer> benutzerListe = new ArrayList<>();
|
||||
|
||||
public static void makeEntries() {
|
||||
Buch b1 = new Buch("Buch1", 2000, "Autor1", "01.01.2020", 10001);
|
||||
|
@ -99,16 +100,74 @@ public class Bibliothek {
|
|||
public static ArrayList<JLabel> buchAuflisten() {
|
||||
ArrayList<JLabel> jlabelList = new ArrayList<>();
|
||||
for(Buch b: bücherListe) {
|
||||
String titel = b.getTitel();
|
||||
int jahr = b.getJahr();
|
||||
String autor = b.getAutor();
|
||||
int kennnummer = b.getKennnummer();
|
||||
JLabel buch = new JLabel("Titel: " + titel
|
||||
+ ", Autor: " + autor
|
||||
+ ", Jahr: " + jahr
|
||||
+ ", Kennnummer: " + kennnummer);
|
||||
JLabel buch = new JLabel("Titel: " + b.getTitel()
|
||||
+ ", Autor: " + b.getAutor()
|
||||
+ ", Jahr: " + b.getJahr()
|
||||
+ ", Kennnummer: " + b.getKennnummer());
|
||||
jlabelList.add(buch);
|
||||
}
|
||||
return jlabelList;
|
||||
}
|
||||
|
||||
public static int dvdLänge() {
|
||||
return dvdListe.size();
|
||||
}
|
||||
|
||||
public static ArrayList<JLabel> dvdAuflisten() {
|
||||
ArrayList<JLabel> jlabelList = new ArrayList<>();
|
||||
for(DVD d: dvdListe) {
|
||||
JLabel dvd = new JLabel("Titel: " + d.getTitel()
|
||||
+ ", Jahr: " + d.getJahr()
|
||||
+ ", Kennnummer: " + d.getKennnummer());
|
||||
jlabelList.add(dvd);
|
||||
}
|
||||
return jlabelList;
|
||||
}
|
||||
|
||||
public static int cdLänge() {
|
||||
return cdListe.size();
|
||||
}
|
||||
|
||||
public static ArrayList<JLabel> cdAuflisten() {
|
||||
ArrayList<JLabel> jlabelList = new ArrayList<>();
|
||||
for(CD c: cdListe) {
|
||||
JLabel cd = new JLabel("Titel: " + c.getTitel()
|
||||
+ ", Jahr: " + c.getJahr()
|
||||
+ ", Kennnummer: " + c.getKennnummer());
|
||||
jlabelList.add(cd);
|
||||
}
|
||||
return jlabelList;
|
||||
}
|
||||
|
||||
public static int bsLänge() {
|
||||
return brettspielListe.size();
|
||||
}
|
||||
|
||||
public static ArrayList<JLabel> bsAuflisten() {
|
||||
ArrayList<JLabel> jlabelList = new ArrayList<>();
|
||||
for(Brettspiel bs: brettspielListe) {
|
||||
JLabel bsp = new JLabel("Titel: " + bs.getTitel()
|
||||
+ ", Jahr: " + bs.getJahr()
|
||||
+ ", Kennnummer: " + bs.getKennnummer());
|
||||
jlabelList.add(bsp);
|
||||
}
|
||||
return jlabelList;
|
||||
}
|
||||
|
||||
public static int vsLänge() {
|
||||
return videospielListe.size();
|
||||
}
|
||||
|
||||
public static ArrayList<JLabel> vsAuflisten() {
|
||||
ArrayList<JLabel> jlabelList = new ArrayList<>();
|
||||
for(Brettspiel vs: brettspielListe) {
|
||||
JLabel vsp = new JLabel("Titel: " + vs.getTitel()
|
||||
+ ", Jahr: " + vs.getJahr()
|
||||
+ ", Kennnummer: " + vs.getKennnummer());
|
||||
jlabelList.add(vsp);
|
||||
}
|
||||
return jlabelList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -37,10 +37,6 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
|||
if(substring.equals("Kunde")) {openMainMenu(b);}
|
||||
if(substring.equals("Mitarbeiter")) {openAdmin();}
|
||||
});
|
||||
bp.add(b1);
|
||||
bp.add(b2);
|
||||
loginPanel.add(bp, BorderLayout.SOUTH);
|
||||
add(mainPanel);
|
||||
setVisible(true);
|
||||
setSize(600, 600);
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
@ -49,7 +45,7 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
|||
}
|
||||
|
||||
public static void openAdmin() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,23 +108,134 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
|||
}
|
||||
|
||||
private static void dvdMenu() {
|
||||
// TODO Auto-generated method stub
|
||||
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) {
|
||||
dvdMenü.add(j);
|
||||
}
|
||||
JButton b1 = new JButton("OK");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
dvdMenü.add(b1, BorderLayout.SOUTH);
|
||||
mainPanel.add(dvdMenü, "DVDs");
|
||||
cl.show(mainPanel, "DVDs");
|
||||
}
|
||||
}
|
||||
|
||||
private static void cdMenu() {
|
||||
// TODO Auto-generated method stub
|
||||
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) {
|
||||
cdMenü.add(j);
|
||||
}
|
||||
JButton b1 = new JButton("OK");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
cdMenü.add(b1, BorderLayout.SOUTH);
|
||||
mainPanel.add(cdMenü, "CDs");
|
||||
cl.show(mainPanel, "CDs");
|
||||
}
|
||||
}
|
||||
|
||||
private static void bsMenu() {
|
||||
// TODO Auto-generated method stub
|
||||
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) {
|
||||
bsMenü.add(j);
|
||||
}
|
||||
JButton b1 = new JButton("OK");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
bsMenü.add(b1, BorderLayout.SOUTH);
|
||||
mainPanel.add(bsMenü, "Brettspiele");
|
||||
cl.show(mainPanel, "Brettspiele");
|
||||
}
|
||||
}
|
||||
|
||||
private static void vsMenu() {
|
||||
// TODO Auto-generated method stub
|
||||
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) {
|
||||
vsMenü.add(j);
|
||||
}
|
||||
JButton b1 = new JButton("OK");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
vsMenü.add(b1, BorderLayout.SOUTH);
|
||||
mainPanel.add(vsMenü, "Videospiele");
|
||||
cl.show(mainPanel, "Videospiele");
|
||||
}
|
||||
}
|
||||
|
||||
private static void myBooks(Benutzer b) {
|
||||
|
||||
Kunde k = (Kunde) b;
|
||||
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");
|
||||
buchMenü.add(b1, BorderLayout.SOUTH);
|
||||
mainPanel.add(buchMenü, "Bücher");
|
||||
cl.show(mainPanel, "Bücher");
|
||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue