Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. package boardGame;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Arrays;
  5. import java.util.List;
  6. import java.util.Random;
  7.  
  8. import javax.swing.ImageIcon;
  9.  
  10. public class Dice extends Board{
  11.  
  12. private static Random rand = new Random();
  13. static ImageIcon diceRolling = new ImageIcon(Dice.class.getResource("dice.gif"));
  14. static ImageIcon one = new ImageIcon(Dice.class.getResource("dice1.png"));
  15. static ImageIcon two = new ImageIcon(Dice.class.getResource("dice2.png"));
  16. static ImageIcon three = new ImageIcon(Dice.class.getResource("dice3.png"));
  17. static ImageIcon four = new ImageIcon(Dice.class.getResource("dice4.png"));
  18. static ImageIcon five = new ImageIcon(Dice.class.getResource("dice5.png"));
  19. static ImageIcon six = new ImageIcon(Dice.class.getResource("dice6.png"));
  20. static ImageIcon img;
  21. int rollDice;
  22.  
  23. public Dice(int d) {
  24. super(space);
  25. d = rollDice;
  26. }
  27.  
  28. public void rollDice(){
  29. rollDice = rand.nextInt(6)+1;
  30. }
  31.  
  32. public int getRollDice(){
  33. return rollDice;
  34. }
  35.  
  36. public ImageIcon getImageIcon() {
  37. if(rollDice == 1){
  38. img = one;
  39. }else if(rollDice == 2){
  40. img = two;
  41. }else if(rollDice == 3){
  42. img = three;
  43. }else if(rollDice == 4){
  44. img = four;
  45. }else if(rollDice == 5){
  46. img = five;
  47. }else if(rollDice == 6){
  48. img = six;
  49. }
  50. return img;
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement