By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,468 Members | 1,865 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,468 IT Pros & Developers. It's quick & easy.

having problems duplacating

P: 1
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 ColouredSemiCircle 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 ColouredSemiCircle(semiDiameter, 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);
}
}
Nov 12 '06 #1
Share this Question
Share on Google+
1 Reply


10K+
P: 13,264
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 ColouredSemiCircle 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 ColouredSemiCircle(semiDiameter, 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);
}
}
Your question is very vague. In the code you have created a semicircle object and a circle object

Expand|Select|Wrap|Line Numbers
  1.  
  2. circle = new ColouredCircle(circleDiameter, imageLocation, circleOffset,
  3. circleColor); 
  4. semi = new ColouredSemiCircle(semiDiameter, imageLocation, semiOffset, 
  5. angles, semiColor);
  6.  
If you want to create 2 semicircles, you replace the creation of the circle by creation of another semicircle with the appropriate arguements.
Did you try that and if you did what error did you get?
Nov 13 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.