📄 clainfosearchcnum.java
字号:
package lab.lab;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ClaInfoSearchCnum extends JDialog implements ActionListener {
Container contentPane;
String[] s;
Dimension faceSize = new Dimension(300, 100);
JLabel jLabel1 = new JLabel();
JComboBox selectCnum;
JButton searchInfo = new JButton();
ClaInfoSearchCnum(JFrame frame) {
super(frame, true);
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() throws Exception {
this.setSize(faceSize);
contentPane = this.getContentPane();
contentPane.setLayout(new FlowLayout());
jLabel1.setText("请输入或者选择班级号");
jLabel1.setFont(new Font("Dialog", 0, 12));
contentPane.add(jLabel1);
TeaBean getId = new TeaBean();
s = getId.getAllId();
selectCnum = new JComboBox(s);
selectCnum.setEditable(true);
selectCnum.setFont(new Font("Dialog", 0, 12));
contentPane.add(selectCnum);
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 == selectCnum) {
this.dispose();
} else if (obj == searchInfo) {
this.dispose();
}
}
public String getCnum() {
return (String) this.selectCnum.getSelectedItem();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -