title: I am having problems setting graphics2D
body: <p>I am making a simple game where there are two rectangles drawn on the screen and with user input from the keyboard arrow keys one of the rectangles (the player) will move. I have made a <code>Main</code> class and a <code>Play</code> class which consists of all my game code, this code includes methods such as <code>init()</code>, <code>update()</code> and <code>render()</code>, the <code>init()</code> deals with all the initial conditions, the <code>update()</code> deals with the movement and key inputs from the input and the <code>render()</code> method deals with drawing the stuff onto the screen such as the background and rectangles.</p>
  
  <p>The problem I am having is drawing my rectangles (which are set up with my variables) on my screen by putting them in my render class, my method is set up with <code>Graphic</code>s and I have been told I require <code>Graphics2D</code> so I am attempting to change my graphics to <code>Graphics2D</code> so that I can draw my rectangles.</p>
  
  <p>Here are my Rectangles which have been set up with my variables at the top of my ode:</p>
  
  <pre><code>Rectangle rectOne = new Rectangle(shiftX, shiftY,90,90);
  Rectangle rectTwo = new Rectangle(500 + buckyPositionX, 330 + buckyPositionY, 210, 150);
  </code></pre>
  
  <p>and here is my render method where I am trying to draw my rectangles using the graphics2D:</p>
  
  <pre><code>    public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException{
  
  
      if(rectOne.intersects(rectTwo)){
          g.drawString("Intersect", 100, 100);}
  
  
      if(g instanceof Graphics2D){//error: Incompatible conditional operand type Graphics and Graphics2D
  
          Graphics2D g2 = (Graphics2D)g;}//cannot cast from Graphics to Graphics2D
  
      ((Graphics2D)g).fill(rectOne);//cannot cast from Graphics to Graphics2D
      ((Graphics2D)g).fill(rectTwo);//cannot cast from Graphics to Graphics2D
  
  }
  </code></pre>
  
  <p>The comments next to my code shows the errors that are appearing when I try to use this code. If any more code or information is required from my Play class please tell me and I will post it. </p>