Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. public void paintComponent(Graphics g)
  2. {
  3. Graphics2D g2 = (Graphics2D)g;
  4.  
  5. g2.drawImage(backImage, 0, 0, this.getWidth(), this.getHeight(),null); // Background
  6. if(slot1On) //Slot Machine
  7. {
  8. g2.drawImage(getSlot1(masterCount), 26, 50,slotSizeW,slotSizeH, null);
  9. }
  10. else
  11. {
  12. g2.drawImage(getSlot1(slot1Pos), 26, 50,slotSizeW,slotSizeH, null);
  13. }
  14. g2.setColor(Color.WHITE); // Text
  15. g2.setFont(new Font(lblAction.getFont().getName(),Font.BOLD,16));
  16. g2.drawString("Press Space to stop the wheel!", 32, 25);
  17. int i,j;
  18. for(i=0;i<3;i++) // Lines on the slot machine
  19. {
  20. g2.setColor(new Color(0,0,0,0.9f));
  21. g2.fillRect(27+ 12 * i + slotSizeW * i, 50 + slotSizeH/2-1, slotSizeW, 3);
  22. g2.fillRect(28+ 12 * i + slotSizeW * i, 50 +slotSizeH/2-4, 3,9);
  23. g2.fillRect(22+ 12 * i + slotSizeW * (i +1) , 50 +slotSizeH/2-4, 3, 9);
  24. for(j=0;j<8;j++)
  25. {
  26. if(j < 4)
  27. {
  28. g2.setColor(new Color(0,0,0,0.9f - j * 0.1f));
  29. g2.fillRect(26 + 12 * i + slotSizeW * i, 50 + j * 4, slotSizeW, 4);
  30. }
  31. else
  32. {
  33. g2.setColor(new Color(0,0,0,0.9f - (8 - j) * 0.1f));
  34. g2.fillRect(26+ 12 * i + slotSizeW * i, 50 + slotSizeH - (8 - j) * 4, slotSizeW, 4);
  35. }
  36. }
  37. }
  38. }
  39.  
  40. public void paintComponent(Graphics g)
  41. {
  42. super.paintComponent(g);
  43. //the rest of your painting here
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement