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