Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package CDRegal;
- import basis.Fenster;
- import basis.Hilfe;
- import basis.Knopf;
- import basis.*;
- import javax.swing.JOptionPane;
- import javax.swing.*;
- public class Regal {
- private String[] Regalplatz;
- private String[] InterbrettA;
- private String[] TitelA;
- private String[] JahrA;
- private int b;
- private Fenster meinFenster;
- private Knopf KEingabe;
- private int x;
- private Knopf meinEnde;
- private Knopf meinAusgabe;
- private int c;
- private int y;
- private Knopf meinSuche;
- private int q;
- public void fuehreAus() {
- meinFenster = new Fenster("Bild",400,100);
- KEingabe = new Knopf("Drück mich",0,0,100,100);
- meinEnde = new Knopf("Ende",100,0,100,100);
- meinAusgabe = new Knopf("Ausgabe",200,0,100,100);
- meinSuche = new Knopf("Suche",300,0,100,100);
- Regalplatz = new String[51];
- InterbrettA = new String[51];
- TitelA = new String[51];
- JahrA = new String[51];
- x = 0;
- c=0;
- y=1;
- q=0;
- this.firstfüllen();
- while(! meinEnde.wurdeGedrueckt())
- {
- this.wurdegedrückt1();
- this.wurdegedrückt2();
- this.beenden();
- this.Suchen();
- }
- }
- public void Suchen()
- {
- if(meinSuche.wurdeGedrueckt())
- {
- String Suche = JOptionPane.showInputDialog("Suche: ");
- if(Regalplatz[q] == Suche)
- {
- JOptionPane.showMessageDialog(null,"Deine Eingabe : " + Suche);
- //System.out.println("Deine Eingabe : " + Suche);
- }
- else
- {
- if(InterbrettA[q] == Suche)
- {
- JOptionPane.showMessageDialog(null,"Deine Eingabe : " + Suche);
- //System.out.println("Deine Eingabe : " + Suche);
- }
- else
- {
- if(TitelA[q] == Suche)
- {
- JOptionPane.showMessageDialog(null,"Deine Eingabe : " + Suche);
- //System.out.println("Deine Eingabe : " + Suche);
- }
- else
- {
- if(JahrA[q] == Suche)
- {
- JOptionPane.showMessageDialog(null,"Deine Eingabe : " + Suche);
- //System.out.println("Deine Eingabe : " + Suche);
- }
- else
- {
- q=q+1;
- }
- }
- }
- }
- }
- }
- public void wurdegedrückt1()
- {
- if(KEingabe.wurdeGedrueckt())
- {
- this.einfüllen();
- }
- }
- public void wurdegedrückt2()
- {
- if(meinAusgabe.wurdeGedrueckt())
- {
- this.GanzeListe();
- }
- }
- public void beenden()
- {
- if(meinEnde.wurdeGedrueckt())
- {
- meinFenster.gibFrei();
- }
- }
- public void firstfüllen()
- {
- b = 0;
- for(int i = 1;i<52;)
- {
- String a = "-";
- Regalplatz[b] = a;
- b = b+1;
- i = i+1;
- }
- Regalplatz[0] = "Regal: ";
- }
- public void einfüllen()
- {
- x = x+1;
- String Interbrett = JOptionPane.showInputDialog("Interpret:");
- String Titel = JOptionPane.showInputDialog("Titel:");
- String Jahr = JOptionPane.showInputDialog("Erscheinungsjahr:");
- c = c+1;
- InterbrettA[x] = Interbrett;
- TitelA[x]= Titel;
- JahrA[x]= Jahr;
- JOptionPane.showMessageDialog(null, InterbrettA[x]);
- JOptionPane.showMessageDialog(null, TitelA[x]);
- JOptionPane.showMessageDialog(null, JahrA[x]);
- String alles = c + "." + Interbrett +", "+ Titel+", " + Jahr;
- Regalplatz[x] = alles;
- }
- public void GanzeListe()
- {
- for(int i = 0;i<50;i=i+1)
- {
- System.out.println(Regalplatz[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement