?? app18_10.java
字號(hào):
// app18_10, 以不同顏色的小圓形鋪滿窗口
import java.awt.*;
class app18_10 extends Frame
{
static app18_10 frm=new app18_10();
public static void main(String args[])
{
frm.setTitle("Random Color");
frm.setSize(200,150);
frm.setVisible(true);
}
public void paint(Graphics g)
{
for(int x=10;x<=180;x=x+20)
for(int y=27;y<=140;y=y+20)
{
int red=(int)(Math.random()*255); // 紅色的隨機(jī)數(shù)
int green=(int)(Math.random()*255); // 綠色的隨機(jī)數(shù)
int blue=(int)(Math.random()*255); // 藍(lán)色的隨機(jī)數(shù)
g.setColor(new Color(red,green,blue)); // 設(shè)置顏色
g.fillOval(x,y,15,15); // 用指定的眼色填滿小圓
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -