commandbutton.java
来自「JHotDraw学习过程中对数组的测试程序haha 学习过程中对数组的测试程序」· Java 代码 · 共 48 行
JAVA
48 行
/* * @(#)CommandButton.java 5.1 * */package CH.ifa.draw.util;import java.awt.*;import java.awt.event.ActionListener;import java.awt.event.ActionEvent;import java.util.*;/** * A Command enabled button. Clicking the button executes the command. * * @see Command */public class CommandButton extends Button implements ActionListener { private Command fCommand; /** * Initializes the button with the given command. * The command's name is used as the label. */ public CommandButton(Command command) { super(command.name()); fCommand = command; addActionListener(this); } /** * Executes the command. If the command's name was changed * as a result of the command the button's label is updated * accordingly. */ public void actionPerformed(ActionEvent e) { fCommand.execute(); if (!getLabel().equals(fCommand.name()) ) { setLabel(fCommand.name()); } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?