Advertisement
Guest User

arne stinkt haaaaaart!

a guest
Nov 30th, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.21 KB | None | 0 0
  1. package CDRegal;
  2.  
  3. import basis.Fenster;
  4. import basis.Hilfe;
  5. import basis.Knopf;
  6. import basis.*;
  7. import javax.swing.JOptionPane;
  8. import javax.swing.*;
  9.  
  10. public class Regal {
  11.  
  12. private String[] Regalplatz;
  13. private String[] InterbrettA;
  14. private String[] TitelA;
  15. private String[] JahrA;
  16. private int b;
  17. private Fenster meinFenster;
  18. private Knopf KEingabe;
  19. private int x;
  20. private Knopf meinEnde;
  21. private Knopf meinAusgabe;
  22. private int c;
  23. private int y;
  24. private Knopf meinSuche;
  25. private int q;
  26.  
  27.  
  28. public void fuehreAus() {
  29. meinFenster = new Fenster("Bild",400,100);
  30. KEingabe = new Knopf("Drück mich",0,0,100,100);
  31. meinEnde = new Knopf("Ende",100,0,100,100);
  32. meinAusgabe = new Knopf("Ausgabe",200,0,100,100);
  33. meinSuche = new Knopf("Suche",300,0,100,100);
  34. Regalplatz = new String[51];
  35. InterbrettA = new String[51];
  36. TitelA = new String[51];
  37. JahrA = new String[51];
  38. x = 0;
  39. c=0;
  40. y=1;
  41. q=0;
  42. this.firstfüllen();
  43. while(! meinEnde.wurdeGedrueckt())
  44. {
  45. this.wurdegedrückt1();
  46. this.wurdegedrückt2();
  47. this.beenden();
  48. this.Suchen();
  49. }
  50.  
  51. }
  52.  
  53. public void Suchen()
  54. {
  55. if(meinSuche.wurdeGedrueckt())
  56. {
  57. String Suche = JOptionPane.showInputDialog("Suche: ");
  58. if(Regalplatz[q] == Suche)
  59. {
  60. JOptionPane.showMessageDialog(null,"Deine Eingabe : " + Suche);
  61. //System.out.println("Deine Eingabe : " + Suche);
  62. }
  63. else
  64. {
  65. if(InterbrettA[q] == Suche)
  66. {
  67. JOptionPane.showMessageDialog(null,"Deine Eingabe : " + Suche);
  68. //System.out.println("Deine Eingabe : " + Suche);
  69. }
  70. else
  71. {
  72.  
  73. if(TitelA[q] == Suche)
  74. {
  75. JOptionPane.showMessageDialog(null,"Deine Eingabe : " + Suche);
  76. //System.out.println("Deine Eingabe : " + Suche);
  77. }
  78. else
  79. {
  80. if(JahrA[q] == Suche)
  81. {
  82. JOptionPane.showMessageDialog(null,"Deine Eingabe : " + Suche);
  83. //System.out.println("Deine Eingabe : " + Suche);
  84. }
  85. else
  86. {
  87. q=q+1;
  88. }
  89. }
  90. }
  91. }
  92. }
  93. }
  94.  
  95.  
  96. public void wurdegedrückt1()
  97. {
  98. if(KEingabe.wurdeGedrueckt())
  99. {
  100. this.einfüllen();
  101. }
  102. }
  103.  
  104.  
  105. public void wurdegedrückt2()
  106. {
  107. if(meinAusgabe.wurdeGedrueckt())
  108. {
  109. this.GanzeListe();
  110. }
  111. }
  112.  
  113.  
  114. public void beenden()
  115. {
  116. if(meinEnde.wurdeGedrueckt())
  117. {
  118. meinFenster.gibFrei();
  119. }
  120.  
  121. }
  122.  
  123.  
  124. public void firstfüllen()
  125. {
  126. b = 0;
  127. for(int i = 1;i<52;)
  128. {
  129. String a = "-";
  130. Regalplatz[b] = a;
  131. b = b+1;
  132. i = i+1;
  133. }
  134. Regalplatz[0] = "Regal: ";
  135. }
  136.  
  137.  
  138. public void einfüllen()
  139. {
  140. x = x+1;
  141. String Interbrett = JOptionPane.showInputDialog("Interpret:");
  142. String Titel = JOptionPane.showInputDialog("Titel:");
  143. String Jahr = JOptionPane.showInputDialog("Erscheinungsjahr:");
  144. c = c+1;
  145. InterbrettA[x] = Interbrett;
  146. TitelA[x]= Titel;
  147. JahrA[x]= Jahr;
  148. JOptionPane.showMessageDialog(null, InterbrettA[x]);
  149. JOptionPane.showMessageDialog(null, TitelA[x]);
  150. JOptionPane.showMessageDialog(null, JahrA[x]);
  151. String alles = c + "." + Interbrett +", "+ Titel+", " + Jahr;
  152. Regalplatz[x] = alles;
  153. }
  154.  
  155.  
  156.  
  157. public void GanzeListe()
  158. {
  159. for(int i = 0;i<50;i=i+1)
  160. {
  161. System.out.println(Regalplatz[i]);
  162. }
  163. }
  164. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement