📄 e743. creating a jbutton component.txt
字号:
Although it is possible to create a button with just a label, it is highly recommended to use an action to create a button. The action can then be shared by other components such as a toolbar.
// Create an action
Action action = new AbstractAction("Button Label") {
// This method is called when the button is pressed
public void actionPerformed(ActionEvent evt) {
// Perform action...
}
};
// Create the button
JButton button = new JButton(action);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -