okay i've been using bluej for learning purposes but i kind of hit a snag would it be possible for someone to code me a main method so that it works as stand alone program please
public class Circle
{
private int diameter;
private int xPosition;
private int yPosition;
private String color;
private boolean isVisible;
public Circle()
{
diameter = 30;
xPosition = 20;
yPosition = 60;
color = "blue";
isVisible = false;
}
/Make visible
/
public void makeVisible()
{
isVisible = true;
draw();
}
/Make invisible
/
public void makeInvisible()
{
erase();
isVisible = false;
}
/Move circle up.
/
public void moveUp()
{
moveVertical(-20);
}
/Move circle down.
/
public void moveDown()
{
moveVertical(20);
}
public void moveRight()
{
moveHorizontal(20);
}
/Move circle left.
/
public void moveLeft()
{
moveHorizontal(-20);
}
/Move circle horizontally
/
public void moveHorizontal(int distance)
{
erase();
xPosition += distance;
draw();
}
/Move vertically
/
public void moveVertical(int distance)
{
erase();
yPosition += distance;
draw();
}
/move horizontally slow
/
public void slowMoveHorizontal(int distance)
{
int delta;
if(distance < 0)
{
delta = -1;
distance = -distance;
}
else
{
delta = 1;
}
for(int i = 0; i < distance; i++)
{
xPosition += delta;
draw();
}
}
/move vertically slow
/
public void slowMoveVertical(int distance)
{
int delta;
if(distance < 0)
{
delta = -1;
distance = -distance;
}
else
{
delta = 1;
}
for(int i = 0; i < distance; i++)
{
yPosition += delta;
draw();
}
}
/Change size
/
public void changeSize(int newDiameter)
{
erase();
diameter = newDiameter;
draw();
}
/Change color
/
public void changeColor(String newColor)
{
color = newColor;
draw();
}
private void draw()
{
if(isVisible) {
Canvas canvas = Canvas.getCanvas();
canvas.draw(this, color, new Ellipse2D.Double(xPosition, yPosition,
diameter, diameter));
canvas.wait(10);
}
}
/deletes circle
/
private void erase()
{
if(isVisible) {
Canvas canvas = Canvas.getCanvas();
canvas.erase(this);
}
}
}