i was trying to create 2 semi circles but it just wont work here is the orginal code with 1 circle and 1 semi circle.... can someone please help
import java.awt.*;
import java.applet.*;
public class Part0 extends Applet {
private Location imageLocation;
private Angles angles;
private int semiDiameter;
private int circleDiameter;
private Color circleColor;
private Color semiColor;
private Location semiOffset;
private Location circleOffset;
private ColouredSemiCir cle semi;
private ColouredCircle circle;
public void init() {
imageLocation = new Location(50, 100);
semiOffset = new Location(0, 0);
circleOffset = new Location(-30, 50);
circleDiameter = 100;
semiDiameter = 30;
angles = new Angles(0, 180);
circleColor = new Color(255, 125, 0);
semiColor = new Color(125, 125, 125);
// Using these, variables to create the body.
circle = new ColouredCircle( circleDiameter, imageLocation, circleOffset,
circleColor);
semi = new ColouredSemiCir cle(semiDiamete r, imageLocation, semiOffset,
angles, semiColor);
}
// Part of the applet not used in Part0.
public void start() {
}
// Part of the applet not used in Part0.
public void stop() {
}
// Part of the applet not used in Part0.
public void destroy() {
}
/**
* Display the shapes created in this Applet.
*/
public void paint (Graphics g) {
semi.paint(g);
circle.paint(g) ;
}
}
import java.awt.*;
import java.applet.*;
public class Part0 extends Applet {
private Location imageLocation;
private Angles angles;
private int semiDiameter;
private int circleDiameter;
private Color circleColor;
private Color semiColor;
private Location semiOffset;
private Location circleOffset;
private ColouredSemiCir cle semi;
private ColouredCircle circle;
public void init() {
imageLocation = new Location(50, 100);
semiOffset = new Location(0, 0);
circleOffset = new Location(-30, 50);
circleDiameter = 100;
semiDiameter = 30;
angles = new Angles(0, 180);
circleColor = new Color(255, 125, 0);
semiColor = new Color(125, 125, 125);
// Using these, variables to create the body.
circle = new ColouredCircle( circleDiameter, imageLocation, circleOffset,
circleColor);
semi = new ColouredSemiCir cle(semiDiamete r, imageLocation, semiOffset,
angles, semiColor);
}
// Part of the applet not used in Part0.
public void start() {
}
// Part of the applet not used in Part0.
public void stop() {
}
// Part of the applet not used in Part0.
public void destroy() {
}
/**
* Display the shapes created in this Applet.
*/
public void paint (Graphics g) {
semi.paint(g);
circle.paint(g) ;
}
}
Comment