Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.40 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. package connect3;
  8. import java.awt.Color;
  9. import java.awt.Graphics2D;
  10. /**
  11.  *
  12.  * @author 100098171
  13.  */
  14. public class LocationBalls {
  15.     private int heldPlayerState =0;
  16.     private int locationX;
  17.     private int locationY;
  18.     private int uniqueNameIDPart; // specifically for debugging
  19.  
  20.        
  21.  
  22.     public void paint(Graphics2D painter) {
  23.            
  24.         while (heldPlayerState == 0)
  25.         {
  26.         painter.drawOval(30, 30, locationX, locationY);
  27.         }
  28.         while (heldPlayerState == 1)
  29.         {
  30.         painter.setColor(Color.red);
  31.         painter.fillOval(30, 30, locationX, locationY);
  32.         }
  33.         while (heldPlayerState == 2)
  34.         {
  35.         painter.setColor(Color.black);
  36.         painter.fillOval(30, 30, locationX, locationY);    
  37.         }
  38.     }
  39.     public void changeColor (int color)
  40.     {
  41.         heldPlayerState = color;
  42.     }
  43.     public void setLocation (int xLoc, int yLoc)
  44.     {
  45.         locationX = xLoc*40;
  46.         locationY = (yLoc*40)+40;
  47.     }
  48.     public void setName (int xloc, int yloc) //debug method
  49.     {
  50.         uniqueNameIDPart = xloc +yloc;
  51.     }
  52.     public int returnName () //debug method
  53.     {
  54.         return uniqueNameIDPart;
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement