📄 resultteacher.java
字号:
package lab.lab;
import java.awt.*;
import javax.swing.*;
public class ResultTeacher extends JFrame {
JLabel jLabel1 = new JLabel();
JButton jbExit = new JButton();
JScrollPane jScrollPanel;
JTable jTabStuInfo;
String sNum, sColValue, sColName, sFromValue, sToValue;
String[][] colValue;
String[] colName = { "教师工号", "姓名", "性别", "民族", "籍贯", "专业", "学院" };
public ResultTeacher(String colname, String colvalue) {
this.sColName = colname;
this.sColValue = colvalue;
this.setTitle("教师信息查询结果");
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation((int) (screenSize.width - 400) / 2,
(int) (screenSize.height - 300) / 2 + 45);
TeaBean rTea = new TeaBean();
try {
colValue = rTea.teaAllSearch(colname, colvalue);
if (colValue == null) {
this.dispose();
JOptionPane.showMessageDialog(null, "没有符合条件的记录");
} else {
jTabStuInfo = new JTable(colValue, colName);
jScrollPanel = new JScrollPane(jTabStuInfo);
this.getContentPane().add(jScrollPanel, BorderLayout.CENTER);
this.pack();
this.setVisible(true);
}
} catch (Exception e) {
e.printStackTrace();
}
}
public ResultTeacher(String colname, String colvalue, String tovalue) {
this.sColName = colname;
this.sFromValue = colvalue;
this.sToValue = tovalue;
this.setTitle("教师信息查询结果");
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation((int) (screenSize.width - 400) / 2,
(int) (screenSize.height - 300) / 2 + 45);
TeaBean rTea = new TeaBean();
try {
colValue = rTea.teaAllSearch(sColName, sFromValue, sToValue);
if (colValue == null) {
this.dispose();
JOptionPane.showMessageDialog(null, "没有符合条件的记录");
} else {
jTabStuInfo = new JTable(colValue, colName);
jScrollPanel = new JScrollPane(jTabStuInfo);
this.getContentPane().add(jScrollPanel, BorderLayout.CENTER);
this.pack();
this.setVisible(true);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -