What is the error in this java code ? What changes should I do to remove it ?

Posted by mekasperasky on Stack Overflow See other posts from Stack Overflow or by mekasperasky
Published on 2011-01-03T14:51:50Z Indexed on 2011/01/03 14:53 UTC
Read the original article Hit count: 192

Filed under:
import javax.swing.*; // For JPanel, etc.
import java.awt.*;           // For Graphics, etc.
import java.awt.geom.*;      // For Ellipse2D, etc.



public class ShapeExample extends JPanel {
  private Ellipse2D.Double circle =
    new Ellipse2D.Double(10, 10, 350, 350);
  private Rectangle2D.Double square =
    new Rectangle2D.Double(10, 10, 350, 350);

  public void paintComponent(Graphics g) {
    clear(g);
    Graphics2D g2d = (Graphics2D)g;
    g2d.fill(circle);
    g2d.draw(square);
  }

  // super.paintComponent clears offscreen pixmap,
  // since we're using double buffering by default.

  protected void clear(Graphics g) {
    super.paintComponent(g);
  }

  protected Ellipse2D.Double getCircle() {
    return(circle);
  }

  public static void main(String[] args) {
    WindowUtilities.openInJFrame(new ShapeExample(), 100, 100);
  }
}

The error I am getting is this .

symbol  : variable WindowUtilities
location: class ShapeExample
    WindowUtilities.openInJFrame(new ShapeExample(), 100, 100);
    ^
1 error

What is wrong in the code?

r

© Stack Overflow or respective owner

Related posts about java