📄 clasearchcnum.java
字号:
package lab.lab;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class ClaSearchCnum extends JFrame implements ActionListener {
Container contentPane;
Dimension faceSize = new Dimension(300, 100);
JLabel jLabel1 = new JLabel();
JTextField cnum = new JTextField(8);
JButton searchInfo = new JButton();
ClaSearchCnum() {
this.setTitle("按班级号查询");
this.setResizable(false);
try {
Init();
} catch (Exception e) {
e.printStackTrace();
}
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation((int) (screenSize.width - 400) / 2,
(int) (screenSize.height - 300) / 2+45);
}
private void Init() {
this.setSize(faceSize);
contentPane = this.getContentPane();
contentPane.setLayout(new FlowLayout());
jLabel1.setText("请输入班级号");
jLabel1.setFont(new Font("Dialog", 0, 12));
contentPane.add(jLabel1);
cnum.setText(null);
cnum.setFont(new Font("Dialog", 0, 12));
contentPane.add(cnum);
searchInfo.setText("确定");
searchInfo.setFont(new Font("Dialog", 0, 12));
contentPane.add(searchInfo);
searchInfo.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
Object obj = e.getSource();
if (obj == searchInfo) {
ResultClass rC = new ResultClass("cnum", cnum.getText());
this.dispose();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -