resultteacher.java

来自「班级管理系统」· Java 代码 · 共 72 行

JAVA
72
字号
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 + =
减小字号Ctrl + -
显示快捷键?