Graphics 클래스의 주요 메소드

CODEDRAGON 카테고리 없음

반응형

 

 

Graphics 클래스의 주요 메소드

 

메소드

설명

public void drawString(String str, int x, int y)

좌표 x, y str문자열을 표시합니다.

public void drawLine(int x1, int y1, int x2, int y2)

좌표 (x1, y1)에서 (x2, y2)까지 직선을 긋는다.

public void drawRect(int x, int y, int width, int height)

좌표 (x, y)로부터 너비가 width이고 높이가 height인 사각형을 그린다.

public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)

(x, y)로부터 너비가 width이고 높이가 height인 모서리가 둥근 사각형을 그린다.

arcWidth arcHeight는 모서리의 크기를 정한다.

public void drawOval(int x, int y, int width, int height)

(x, y)로부터 너비가 width이고 높이가 height인 사각형안에 들어가는 타원을 그린다. width height가 같으면 원이 된다.

public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)

(x, y)로부터 너비가 width이고 높이가 height인 사각형안에 들어가는 원호를 그린다.

startAngle은 원호의 시작 각()이고, arcAngle은 원호로 형성되는 부채꼴의 각이다.

public void drawPolygon(int xPoints[], int yPoints[], int nPoints)

다각형을 그린다. 배열 xPoints yPoints는 꼭지점의 x y의 집합이고, nPoints는 다각형의 꼭지점 개수로 배열의 크기와 일치한다.

public void drawPolygon(Polygon p)

다각형 p를 그린다. Polygon은 다각형을 구현하는 클래스이다.

public void drawPolyline(int xPoints[], int yPoints[], int nPoints)

연결된 직선들을 그린다. 배열 xPoints yPoints는 연결점의 x y의 집합이고, nPoints는 연결점의 개수이다.

public void clearRect(int x, int y, int width, int height)

주어진 범위에 있는 이미지를 지운다.

 

 


반응형