📄 driver.java
字号:
import java.awt.Color;import javax.swing.JFrame;/** Author: David D. Riley * Date: Jan, 2005 * Random Oval (Figure 6.1) */ public class Driver { private JFrame window; private Oval redOval; /** post: A window is displayed * and a randomly-sized red oval is displayed. */ public Driver() { window = new JFrame("Random Red Oval"); window.setBounds(10, 10, 600, 500); window.setVisible(true); window.setLayout(null); redOval = new Oval( (int)(Math.random()*600),(int)(Math.random()*500), (int)(Math.random()*600),(int)(Math.random()*500) ); redOval.setBackground(Color.red); window.add(redOval, 0); window.repaint(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -