Advertisement
Guest User

Projekt

a guest
May 25th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. //class studenci
  2. ArrayList<Student> lista = new ArrayList<Student>();
  3. public void wstaw(String imie, String nazwisko, int nrAlbumu){
  4. lista.add(new Student(imie,nazwisko,nrAlbumu));
  5. }
  6. public Student wyswietl(int i){
  7. Student napis;
  8. napis = lista.get(i);
  9. return napis;
  10.  
  11.  
  12. //JFrame
  13. private void nrAlbumuKeyReleased(java.awt.event.KeyEvent evt) { //analogicznie zrobione z imieniem i nazwiskiem
  14. nrAlbumuzm=Integer.parseInt(nrAlbumu.getText());
  15. }
  16. private void wykonajActionPerformed(java.awt.event.ActionEvent evt) {
  17. int ilosc=0;
  18. wyswietlanie.setText("");
  19. st.wstaw(imiezm,nazwiskozm,nrAlbumuzm);
  20. nrAlbumu.setText("");
  21. imie.setText("");
  22. nazwisko.setText("");
  23. String napis = String.valueOf(st.wyswietl(ilosc));
  24. wyswietlanie.setText(napis);
  25. ilosc++;
  26. }
  27.  
  28. private void dodajActionPerformed(java.awt.event.ActionEvent evt) {
  29. nrAlbumu.setVisible(true);
  30. imie.setVisible(true);
  31. nazwisko.setVisible(true);
  32. nralbumulabel.setVisible(true);
  33. imielabel.setVisible(true);
  34. nazwiskolabel.setVisible(true);
  35. wykonaj.setVisible(true);
  36. clean.setVisible(true);
  37. }
  38.  
  39. private void wyswietlActionPerformed(java.awt.event.ActionEvent evt) {
  40. nrAlbumu.setVisible(false);
  41. imie.setVisible(false);
  42. nazwisko.setVisible(false);
  43. nralbumulabel.setVisible(false);
  44. imielabel.setVisible(false);
  45. nazwiskolabel.setVisible(false);
  46. wykonaj.setVisible(false);
  47. clean.setVisible(false);
  48. for(int i=0;i<st.rozmiar;i++){ //rozmiar to zmienna przechowująca aktualny rozmiar listy
  49. String napis = String.valueOf(st.wyswietl(i));
  50. wyswietlanie.setText(napis);
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement