원의 둘레에 관한 질문. 원 (원주)의 외부 색상을 변경하려면 내가 어디에 가서 그냥 정확히 어떻게 잘 모릅니다 Public void drawArc
below..after 다음 코드 후 시작하지arcAngle을 사용하여 원의 바깥 쪽을 칠하기
drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
을 사용
public void paintComponent(Graphics g) {
super.paintComponent(g);
Dimension d = getSize();
for(int i = 0; i < 100; ++i) {
Color color = new Color(generator.nextInt(255), generator.nextInt(255), generator.nextInt(255));
g.setColor(color);
int circleSize = generator.nextInt(d.width/4);
int x = generator.nextInt(d.width - circleSize);
int y = generator.nextInt(d.height - circleSize);
g.fillOval(x, y, circleSize, circleSize);
g.drawArc(x, y, circleSize, circleSize, 0, 360);
}
}
과제를 잘못 이해했을 가능성이 있습니까? 선생님은 당신이'Graphics' 클래스의'drawArc' 메소드를 사용하기를 원합니다. –
@DavidWallace 동의하고 이것이 내가 그것을 바꿨지 만 지금은 다시 붙어 있습니다 .. –
@DavidWallace는 색을 바꾸기 위해 성명을 추가해 주셔서 감사합니다! –