?? target.java
字號:
/*
* File: Target.java
* Name:
* Section Leader:
* -----------------
* This file is the starter file for the Target problem.
*/
import acm.graphics.*;
import acm.program.*;
import java.awt.*;
public class Target extends GraphicsProgram {
/**
*
*/
private static final long serialVersionUID = 1L;
private static final int BIG_RED_RADIUS = 72;
private static final int SMALL_RED_RADIUS = (int)(72 * 0.3);
private static final int WHITE_RADIUS = (int)(72 * 0.65);
public void run() {
int centerX = getWidth()/2;
int centerY = getHeight()/2;
/*big red circle*/
GOval big_red_circle = new GOval(centerX-BIG_RED_RADIUS, centerY-BIG_RED_RADIUS, 2 * BIG_RED_RADIUS, 2 * BIG_RED_RADIUS);
big_red_circle.setFillColor(Color.RED);
big_red_circle.setFilled(true);
add(big_red_circle);
/*white circle*/
GOval white_circle = new GOval(centerX-WHITE_RADIUS, centerY-WHITE_RADIUS, 2 * WHITE_RADIUS, 2 * WHITE_RADIUS);
white_circle.setFillColor(Color.WHITE);
white_circle.setFilled(true);
add(white_circle);
/*small red circle*/
GOval small_red_circle = new GOval(centerX-SMALL_RED_RADIUS, centerY-SMALL_RED_RADIUS, 2 * SMALL_RED_RADIUS, 2 * SMALL_RED_RADIUS);
small_red_circle.setFillColor(Color.RED);
add(small_red_circle);
small_red_circle.setFilled(true);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -