Alguém sabe como fazer uma tarte utilizando o método GArc ?
estou a tentar sem sucesso, só consigo fazer uma fatia :-p
Código :
public class Pie extends GCompound
{
public Pie (int radius, int nSlices)
{
RandomGenerator rand = RandomGenerator.getInstance();
double width =radius, height = radius, start = 0, sweep = 360/nSlices;
for (int i = 0; i < nSlices; i++)
{
GArc arc = new GArc(width, height, start, sweep);
arc.setColor(Color.RED);
arc.setFilled(true);
arc.setFillColor(Color.YELLOW);
this.add(arc, i*start, sweep);
}
}
}
estou a tentar sem sucesso, só consigo fazer uma fatia :-p
Código :
public class Pie extends GCompound
{
public Pie (int radius, int nSlices)
{
RandomGenerator rand = RandomGenerator.getInstance();
double width =radius, height = radius, start = 0, sweep = 360/nSlices;
for (int i = 0; i < nSlices; i++)
{
GArc arc = new GArc(width, height, start, sweep);
arc.setColor(Color.RED);
arc.setFilled(true);
arc.setFillColor(Color.YELLOW);
this.add(arc, i*start, sweep);
}
}
}
Fazer uma tarte com GArc (JAVA)
Aucun commentaire:
Enregistrer un commentaire