driver.java
来自「Java程序设计(美) David D. Riley著 机械工业出版社 书籍配套」· Java 代码 · 共 35 行
JAVA
35 行
import javax.swing.JFrame;import java.awt.Color;/** PolkaDot Program * Author: David Riley * Date: January, 2005 */public class Driver { private JFrame window; public Driver() { int yCount, xCount; Oval dot; Color rowColor; window = new JFrame("Polkadot by column"); window.setBounds(10, 10, 200, 200); window.setVisible(true); window.setLayout(null); xCount = 0; while ( xCount != 8 ) { rowColor = new Color(xCount/9.0f, xCount/9.0f, xCount/9.0f); yCount = 0; while ( yCount !=12) { dot = new Oval(xCount*25, yCount*15, 10, 10); dot.setBackground(rowColor); window.add(dot, 0); yCount++; } xCount++; } window.repaint(); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?