Need Help with java project {Please...}
HI,
I working on this java project where I have to construct an applet. The applet has to be an Ellipse thats is filled with a color other than white and it has to resize when the window is minimized. Here is what I have so far... If there is anyone who can help me with this problem I would gladly appreciate it as this project is due tomorrow..Thnx in advance.
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Ellipse2D;
public class EllipseApplet extends Applet
{
public void paint (Graphics g)
{ // recover Graphics2D
Graphics2D g2 = (Graphics2D)g;
//Construct an Ellipse and draw it.
Ellipse2D.Double easterEgg = new Ellipse2D.Double(5, 10, 20, 30);
g2.setColor(Color.blue);
g2.fill(easterEgg); // fill the ellipse in blue
}
}
However I keep getting an error when I compile the program and I don't quite understand it.
This is the error message;
H:\EllipseApplet.java:13: cannot resolve symbol
symbol : variable Color
location: class EllipseApplet
g2.setColor(Color.blue);
^
1 error
Tool completed with exit code 1
Re: Need Help with java project {Please...}
Quote:
Originally posted here by Big_Bolo
H:\EllipseApplet.java:13: cannot resolve symbol
symbol : variable Color
location: class EllipseApplet
g2.setColor(Color.blue);
^
It's pretty straightforward, it's complaining about your use of Color.blue, primarily because java.awt.Color isn't imported at the top of your file. If you add the import it will probably work fine.