driver.java
来自「Java程序设计(美) David D. Riley著 机械工业出版社 书籍配套」· Java 代码 · 共 38 行
JAVA
38 行
/** Driver for the SearchForSizeList class (Figure 11.15) * Author: David Riley * Date: January, 2005 */import java.awt.*;import javax.swing.*;public class Driver { private SearchForSizeList listOfComponent; private JButton bigBtn, smallBtn, midBtn, otherBtn; public Driver() { assignAllButtonsNewObjects(); listOfComponent = new SearchForSizeList(); listOfComponent.add(midBtn); listOfComponent.add(bigBtn); listOfComponent.add(smallBtn); assignAllButtonsNewObjects(); System.out.println("BigBtn is in the list: " + listOfComponent.containsSameSize(bigBtn)); System.out.println("SmallBtn is in the list: " + listOfComponent.containsSameSize(smallBtn)); System.out.println("MidBtn is in the list: " + listOfComponent.containsSameSize(midBtn)); System.out.println("OtherBtn is in the list: " + listOfComponent.containsSameSize(otherBtn)); } private void assignAllButtonsNewObjects() { bigBtn = new JButton(""); bigBtn.setBounds(0, 0, 1000, 1000); smallBtn = new JButton(""); smallBtn.setBounds(0, 0, 10, 10); midBtn = new JButton(""); midBtn.setBounds(0, 0, 100, 100); otherBtn = new JButton(""); otherBtn.setBounds(0, 0, 100, 10); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?