FilledRectExample

Retired DISLab
Swpark (토론 | 기여) 사용자의 2014년 1월 26일 (일) 09:48 버전
(비교) ← 이전 판 | 현재 판 (비교) | 다음 판 → (비교)
이동: 둘러보기, 찾기

FilledRectExample.java

import acm.program.*;
import java.awt.*;
 
public class FilledRectExample extends GraphicsProgram {
	public void run() {
		double width = getWidth();
		double height = getHeight();
		double stripe = width / 3;
		add(new FilledRect(0, 0, stripe, height, Color.BLUE));
		add(new FilledRect(stripe, 0, stripe, height, Color.WHITE));
		add(new FilledRect(2 * stripe, 0, stripe, height, Color.RED));
	}
 
	private static final long serialVersionUID = 1;
}


FilledRect.java

import acm.graphics.*;
import java.awt.*;
 
public class FilledRect extends GRect {
 
	public FilledRect(double x, double y, double width, double height) {
		super(x, y, width, height);
		setFilled(true);
	}
 
	public FilledRect(double x, double y, double width, double height, Color color) {
		this(x, y, width, height);
		setColor(color);
	}
}
개인 도구
이름공간
변수
행위
둘러보기
구성원
연구
연구실
기타
도구모음
인쇄/내보내기