📄 driver.java
字号:
/** 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -