📄 driver.java
字号:
import java.awt.Color;import javax.swing.JFrame;/** Author: David D. Riley * Date: Jan, 2005 * An erroneous prototype of the caterpillar program (Figure 3.28) */ // This prototype contains two logic errors. public class Driver { private JFrame theWindow; private Oval head, frontSegment, midSegment, rearSegment; public Driver() { theWindow = new JFrame( "The Pede" ); theWindow.setBounds(10, 10, 500, 250); theWindow.setLayout(null); theWindow.setVisible(true); head = new Oval(110, 70, 80, 80 ); theWindow.add(head, 0); head.repaint(); frontSegment = new Oval(180, 100, 50, 50); theWindow.add(frontSegment, 0); frontSegment.repaint(); midSegment = new Oval(230, 100, 0, 50); theWindow.add(midSegment, 0); midSegment.repaint(); rearSegment = new Oval(180, 100, 50, 50); theWindow.add(rearSegment, 0); rearSegment.repaint(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -