📄 confirmwindow.java~5~
字号:
package test;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class ConfirmWindow extends JFrame implements ActionListener {
public ConfirmWindow() {
setSize(600, 400);
setTitle("A TEST");
Container content = getContentPane();
content.setLayout(new BorderLayout());
content.setBackground(Color.white);
JButton test = new JButton("TEST");
test.addActionListener(this);
content.add("Center", test);
setVisible(true);
}
public static void main(String[] args) {
new ConfirmWindow();
}
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("TEST")) {
JOptionPane.showConfirmDialog(this, "You are testing!", "TEST", 3);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -