'JAVA/JSP/Source'에 해당되는 글 36건
- 2008.07.14 Graphics(clipRect())
----- ClipRect -----
import java.awt.*;
import java.util.*;
public class ClipRec extends java.applet.Applet
{
public void init()
{
}
public void paint(Graphics g)
{
int x,y,red,green,blue;
Random ran = new Random();
Color c;
g.clipRect(100,100,100,100); // 설정된 크기만 draw적용
for(int i=0; i<100; i++)
{
red = ran.nextInt(256);
green = ran.nextInt(256);
blue = ran.nextInt(256);
c = new Color(red, green, blue);
x = ran.nextInt(250);
y = ran.nextInt(250);
g.setColor(c);
g.drawRect(x,y,10,10);
}
}
}
'JAVA/JSP > Source' 카테고리의 다른 글
Image (0) | 2008.07.14 |
---|---|
Thread (0) | 2008.07.14 |
아날로그 시계(AWT) (0) | 2008.07.14 |
JCheckBox/ JRadioButton /JComboBox/ JTable (0) | 2008.07.14 |
야구게임 (0) | 2008.07.14 |