added method to view library catalogue without logging in
parent
36d06efb2f
commit
db2ee4f093
|
@ -21,8 +21,20 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
||||||
JPanel loginPanel = new JPanel(new BorderLayout());
|
JPanel loginPanel = new JPanel(new BorderLayout());
|
||||||
JLabel text1 = new JLabel("Login mit Kennnummer:");
|
JLabel text1 = new JLabel("Login mit Kennnummer:");
|
||||||
loginPanel.add(text1, BorderLayout.NORTH);
|
loginPanel.add(text1, BorderLayout.NORTH);
|
||||||
|
JPanel loginGrid = new JPanel(new BorderLayout());
|
||||||
JTextField field1 = new JTextField(20);
|
JTextField field1 = new JTextField(20);
|
||||||
loginPanel.add(field1, BorderLayout.CENTER);
|
loginGrid.add(field1);
|
||||||
|
loginPanel.add(loginGrid, BorderLayout.CENTER);
|
||||||
|
JButton b0 = new JButton("Registrieren");
|
||||||
|
b0.addActionListener(e -> { nutzerAnlegen();});
|
||||||
|
JButton b3 = new JButton("Ohne Anmeldung fortfahren");
|
||||||
|
b3.addActionListener(e -> {
|
||||||
|
browseMedia();
|
||||||
|
});
|
||||||
|
JPanel buttonGrid = new JPanel(new GridLayout(1,2,10,10));
|
||||||
|
buttonGrid.add(b0);
|
||||||
|
buttonGrid.add(b3);
|
||||||
|
loginGrid.add(buttonGrid, BorderLayout.SOUTH);
|
||||||
JPanel bp = new JPanel(new GridLayout(1,2,10,10));
|
JPanel bp = new JPanel(new GridLayout(1,2,10,10));
|
||||||
JButton b1 = new JButton("Abbrechen");
|
JButton b1 = new JButton("Abbrechen");
|
||||||
b1.addActionListener(e -> dispose());
|
b1.addActionListener(e -> dispose());
|
||||||
|
@ -48,6 +60,36 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
||||||
cl.show(mainPanel, "loginPanel");
|
cl.show(mainPanel, "loginPanel");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void browseMedia() {
|
||||||
|
JPanel browsePanel = new JPanel(new GridLayout(6, 1, 10, 10));
|
||||||
|
JButton b1 = new JButton("Bücher");
|
||||||
|
Kunde k = null;
|
||||||
|
b1.addActionListener(e -> bookMenu(k));
|
||||||
|
JButton b2 = new JButton("DVDs");
|
||||||
|
b2.addActionListener(e -> dvdMenu(k));
|
||||||
|
JButton b3 = new JButton("CDs");
|
||||||
|
b3.addActionListener(e -> cdMenu(k));
|
||||||
|
JButton b4 = new JButton("Brettspiele");
|
||||||
|
b4.addActionListener(e -> bsMenu(k));
|
||||||
|
JButton b5 = new JButton("Videospiele");
|
||||||
|
b5.addActionListener(e -> vsMenu(k));
|
||||||
|
JButton b6 = new JButton("OK");
|
||||||
|
b6.addActionListener(e -> cl.show(mainPanel, "loginPanel"));
|
||||||
|
browsePanel.add(b1);
|
||||||
|
browsePanel.add(b2);
|
||||||
|
browsePanel.add(b3);
|
||||||
|
browsePanel.add(b4);
|
||||||
|
browsePanel.add(b5);
|
||||||
|
browsePanel.add(b6);
|
||||||
|
mainPanel.add(browsePanel, "browsePanel");
|
||||||
|
cl.show(mainPanel, "browsePanel");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void nutzerAnlegen() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private static void openAdmin() {
|
private static void openAdmin() {
|
||||||
JPanel adminPanel = new JPanel(new BorderLayout());
|
JPanel adminPanel = new JPanel(new BorderLayout());
|
||||||
JPanel adminGrid = new JPanel(new GridLayout(2, 1, 10, 10));
|
JPanel adminGrid = new JPanel(new GridLayout(2, 1, 10, 10));
|
||||||
|
@ -90,15 +132,15 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
||||||
JLabel text1 = new JLabel("Ihre Kennnnummer: " + k.getKennnummer());
|
JLabel text1 = new JLabel("Ihre Kennnnummer: " + k.getKennnummer());
|
||||||
mediumPanel.add(text1);
|
mediumPanel.add(text1);
|
||||||
JButton b1 = new JButton("Bücher");
|
JButton b1 = new JButton("Bücher");
|
||||||
b1.addActionListener(e -> bookMenu());
|
b1.addActionListener(e -> bookMenu(k));
|
||||||
JButton b2 = new JButton("DVDs");
|
JButton b2 = new JButton("DVDs");
|
||||||
b2.addActionListener(e -> dvdMenu());
|
b2.addActionListener(e -> dvdMenu(k));
|
||||||
JButton b3 = new JButton("CDs");
|
JButton b3 = new JButton("CDs");
|
||||||
b3.addActionListener(e -> cdMenu());
|
b3.addActionListener(e -> cdMenu(k));
|
||||||
JButton b4 = new JButton("Brettspiele");
|
JButton b4 = new JButton("Brettspiele");
|
||||||
b4.addActionListener(e -> bsMenu());
|
b4.addActionListener(e -> bsMenu(k));
|
||||||
JButton b5 = new JButton("Videospiele");
|
JButton b5 = new JButton("Videospiele");
|
||||||
b5.addActionListener(e -> vsMenu());
|
b5.addActionListener(e -> vsMenu(k));
|
||||||
JButton b6 = new JButton("Ausleihe");
|
JButton b6 = new JButton("Ausleihe");
|
||||||
b6.addActionListener(e -> ausleihenMenü(k));
|
b6.addActionListener(e -> ausleihenMenü(k));
|
||||||
JButton b7 = new JButton("Rückgabe");
|
JButton b7 = new JButton("Rückgabe");
|
||||||
|
@ -220,7 +262,7 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
||||||
cl.show(mainPanel, "Rückgabe");
|
cl.show(mainPanel, "Rückgabe");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void bookMenu() {
|
private static void bookMenu(Kunde k) {
|
||||||
int i = Bibliothek.bücherLänge();
|
int i = Bibliothek.bücherLänge();
|
||||||
JPanel buchMenü = new JPanel(new GridLayout(i+2, 2, 10, 10));
|
JPanel buchMenü = new JPanel(new GridLayout(i+2, 2, 10, 10));
|
||||||
JLabel text0 = new JLabel("Ausleihe für 4 Wochen, bis zu 3 Mal verlängerbar.");
|
JLabel text0 = new JLabel("Ausleihe für 4 Wochen, bis zu 3 Mal verlängerbar.");
|
||||||
|
@ -230,13 +272,18 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
||||||
buchMenü.add(j);
|
buchMenü.add(j);
|
||||||
}
|
}
|
||||||
JButton b1 = new JButton("OK");
|
JButton b1 = new JButton("OK");
|
||||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
b1.addActionListener(e -> {
|
||||||
|
if(k == null) {
|
||||||
|
cl.show(mainPanel, "browsePanel");
|
||||||
|
} else {
|
||||||
|
cl.show(mainPanel, "mediumPanel");}
|
||||||
|
});
|
||||||
buchMenü.add(b1, BorderLayout.SOUTH);
|
buchMenü.add(b1, BorderLayout.SOUTH);
|
||||||
mainPanel.add(buchMenü, "Bücher");
|
mainPanel.add(buchMenü, "Bücher");
|
||||||
cl.show(mainPanel, "Bücher");
|
cl.show(mainPanel, "Bücher");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void dvdMenu() {
|
private static void dvdMenu(Kunde k) {
|
||||||
int i = Bibliothek.dvdLänge();
|
int i = Bibliothek.dvdLänge();
|
||||||
JPanel dvdMenü = new JPanel(new GridLayout(i+2, 2, 10, 10));
|
JPanel dvdMenü = new JPanel(new GridLayout(i+2, 2, 10, 10));
|
||||||
JLabel text0 = new JLabel("Ausleihe für 1 Woche, keine Verlängerung.");
|
JLabel text0 = new JLabel("Ausleihe für 1 Woche, keine Verlängerung.");
|
||||||
|
@ -246,13 +293,18 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
||||||
dvdMenü.add(j);
|
dvdMenü.add(j);
|
||||||
}
|
}
|
||||||
JButton b1 = new JButton("OK");
|
JButton b1 = new JButton("OK");
|
||||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
b1.addActionListener(e -> {
|
||||||
|
if(k == null) {
|
||||||
|
cl.show(mainPanel, "browsePanel");
|
||||||
|
} else {
|
||||||
|
cl.show(mainPanel, "mediumPanel");}
|
||||||
|
});
|
||||||
dvdMenü.add(b1, BorderLayout.SOUTH);
|
dvdMenü.add(b1, BorderLayout.SOUTH);
|
||||||
mainPanel.add(dvdMenü, "DVDs");
|
mainPanel.add(dvdMenü, "DVDs");
|
||||||
cl.show(mainPanel, "DVDs");
|
cl.show(mainPanel, "DVDs");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void cdMenu() {
|
private static void cdMenu(Kunde k) {
|
||||||
int i = Bibliothek.cdLänge();
|
int i = Bibliothek.cdLänge();
|
||||||
JPanel cdMenü = new JPanel(new GridLayout(i+2, 2, 10, 10));
|
JPanel cdMenü = new JPanel(new GridLayout(i+2, 2, 10, 10));
|
||||||
JLabel text0 = new JLabel("Ausleihe für 2 Wochen, keine Verlängerung.");
|
JLabel text0 = new JLabel("Ausleihe für 2 Wochen, keine Verlängerung.");
|
||||||
|
@ -262,13 +314,17 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
||||||
cdMenü.add(j);
|
cdMenü.add(j);
|
||||||
}
|
}
|
||||||
JButton b1 = new JButton("OK");
|
JButton b1 = new JButton("OK");
|
||||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
b1.addActionListener(e -> {
|
||||||
cdMenü.add(b1, BorderLayout.SOUTH);
|
if(k == null) {
|
||||||
|
cl.show(mainPanel, "browsePanel");
|
||||||
|
} else {
|
||||||
|
cl.show(mainPanel, "mediumPanel");}
|
||||||
|
}); cdMenü.add(b1, BorderLayout.SOUTH);
|
||||||
mainPanel.add(cdMenü, "CDs");
|
mainPanel.add(cdMenü, "CDs");
|
||||||
cl.show(mainPanel, "CDs");
|
cl.show(mainPanel, "CDs");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void bsMenu() {
|
private static void bsMenu(Kunde k) {
|
||||||
int i = Bibliothek.bsLänge();
|
int i = Bibliothek.bsLänge();
|
||||||
JPanel bsMenü = new JPanel(new GridLayout(i+2, 2, 10, 10));
|
JPanel bsMenü = new JPanel(new GridLayout(i+2, 2, 10, 10));
|
||||||
JLabel text0 = new JLabel("Ausleihe für 2 Wochen, keine Verlängerung.");
|
JLabel text0 = new JLabel("Ausleihe für 2 Wochen, keine Verlängerung.");
|
||||||
|
@ -278,13 +334,17 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
||||||
bsMenü.add(j);
|
bsMenü.add(j);
|
||||||
}
|
}
|
||||||
JButton b1 = new JButton("OK");
|
JButton b1 = new JButton("OK");
|
||||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
b1.addActionListener(e -> {
|
||||||
bsMenü.add(b1, BorderLayout.SOUTH);
|
if(k == null) {
|
||||||
|
cl.show(mainPanel, "browsePanel");
|
||||||
|
} else {
|
||||||
|
cl.show(mainPanel, "mediumPanel");}
|
||||||
|
}); bsMenü.add(b1, BorderLayout.SOUTH);
|
||||||
mainPanel.add(bsMenü, "Brettspiele");
|
mainPanel.add(bsMenü, "Brettspiele");
|
||||||
cl.show(mainPanel, "Brettspiele");
|
cl.show(mainPanel, "Brettspiele");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void vsMenu() {
|
private static void vsMenu(Kunde k) {
|
||||||
int i = Bibliothek.vsLänge();
|
int i = Bibliothek.vsLänge();
|
||||||
JPanel vsMenü = new JPanel(new GridLayout(i+2, 2, 10, 10));
|
JPanel vsMenü = new JPanel(new GridLayout(i+2, 2, 10, 10));
|
||||||
JLabel text0 = new JLabel("Ausleihe für 4 Wochen, einmalige Verlängerung möglich.");
|
JLabel text0 = new JLabel("Ausleihe für 4 Wochen, einmalige Verlängerung möglich.");
|
||||||
|
@ -294,8 +354,12 @@ public class BibliothekGUI extends JFrame implements ActionListener{
|
||||||
vsMenü.add(j);
|
vsMenü.add(j);
|
||||||
}
|
}
|
||||||
JButton b1 = new JButton("OK");
|
JButton b1 = new JButton("OK");
|
||||||
b1.addActionListener(e -> cl.show(mainPanel, "mediumPanel"));
|
b1.addActionListener(e -> {
|
||||||
vsMenü.add(b1, BorderLayout.SOUTH);
|
if(k == null) {
|
||||||
|
cl.show(mainPanel, "browsePanel");
|
||||||
|
} else {
|
||||||
|
cl.show(mainPanel, "mediumPanel");}
|
||||||
|
}); vsMenü.add(b1, BorderLayout.SOUTH);
|
||||||
mainPanel.add(vsMenü, "Videospiele");
|
mainPanel.add(vsMenü, "Videospiele");
|
||||||
cl.show(mainPanel, "Videospiele");
|
cl.show(mainPanel, "Videospiele");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue