Guest User

Untitled

a guest
Jul 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. package sikoban.gui;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Dimension;
  5.  
  6. import javax.swing.BorderFactory;
  7. import javax.swing.ImageIcon;
  8. import javax.swing.JButton;
  9.  
  10. import sikoban.Ruututyyppi;
  11.  
  12. public class Ruutunappi extends JButton {
  13. private ImageIcon pelaaja = new ImageIcon("pelaaja.png");;
  14. private ImageIcon seina = new ImageIcon("seina.png");
  15. private ImageIcon este = new ImageIcon("este.png");
  16. private ImageIcon maali = new ImageIcon("maali.png");
  17.  
  18. public Ruutunappi(int y, int x) {
  19. JButton nappi = new JButton();
  20. nappi.setPreferredSize(new Dimension(30, 30));
  21. nappi.setBorder(BorderFactory.createEtchedBorder(Color.GRAY, null));
  22. }
  23. public void nayta(Ruututyyppi tyyppi) {
  24. switch (tyyppi) {
  25. case PELAAJA:
  26. this.setIcon(pelaaja);
  27. case SEINA:
  28. this.setIcon(seina);
  29. case ESTE:
  30. this.setIcon(este);
  31. case MAALI:
  32. this.setIcon(maali);
  33. default:
  34. this.setBackground(Color.WHITE);
  35. }
  36. }
  37. }
Add Comment
Please, Sign In to add comment