📄 driver.java
字号:
import javax.swing.JFrame;import java.awt.Color;/** PolkaDot Program - version writte with for loops (Figure 10.22) * Author: David Riley * Date: January, 2005 */public class Driver { private JFrame window; public Driver() { Oval dot; Color rowColor; window = new JFrame("Polkadots"); window.setBounds(10, 10, 200, 200); window.setVisible(true); window.setLayout(null); for (int yCount=0; yCount != 12; yCount++) { rowColor = new Color(yCount/13.0f, yCount/13.0f, yCount/13.0f); // rowColor is gray an intensity of yCount/13. // (0.0f is black and 1.0f is white) for (int xCount=0; xCount != 8; xCount++) { dot = new Oval(xCount*25, yCount*15, 10, 10); dot.setBackground(rowColor); window.add(dot, 0); } } window.repaint(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -