⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 driver.java

📁 Java程序设计(美) David D. Riley著 机械工业出版社 书籍配套 代码
💻 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 + -