📄 driver.java
字号:
import java.awt.Color;import javax.swing.JFrame;/** Author: David D. Riley * Date: Jan, 2005 * Example of clipping and overlapping * Rectangles and Ovals (Figure 3.20) */public class Driver { private JFrame window; private Rectangle bigSquare, smallSquare; private Oval blackOval, whiteOval; public Driver() { window = new JFrame( "the window" ); window.setBounds(50, 50, 300, 200); window.setLayout(null); window.setBackground(Color.white); window.setVisible(true); blackOval = new Oval(100, 100, 100, 40); window.add(blackOval, 0); bigSquare = new Rectangle(50, 20, 100, 100); bigSquare.setBackground(Color.lightGray); blackOval.add(bigSquare, 0); smallSquare = new Rectangle(200, 30, 40, 40); smallSquare.setBackground(Color.gray); window.add(smallSquare, 0); whiteOval = new Oval(210, 50, 20, 15); whiteOval.setBackground(Color.white); window.add(whiteOval, 0); window.repaint(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -