myframe.java
来自「< Java多线程设计模式>> 一书」· Java 代码 · 共 25 行
JAVA
25 行
import java.io.IOException;
import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JButton;
public class MyFrame extends JFrame implements ActionListener {
public MyFrame() {
super("MyFrame");
getContentPane().setLayout(new FlowLayout());
getContentPane().add(new JLabel("Thread-Per-Message Sample"));
JButton button = new JButton("Execute");
getContentPane().add(button);
button.addActionListener(this);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
Service.service();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?