resultclass.java

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

JAVA
72
字号
package lab.lab;
import java.awt.*;
import javax.swing.*;

public class ResultClass extends JFrame {
	JLabel jLabel1 = new JLabel();

	JButton jbExit = new JButton();

	JScrollPane jScrollPanel;

	JTable jTabClaInfo;

	String cNum, sColValue, sColName, sFromValue, sToValue;

	String[][] colValue;

	String[] colName = { "班级号", "所属院", "班主任", "总人数", "班费",  "出勤情况"};

	public ResultClass(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);
		ClaBean rCla = new ClaBean();
		try {
			colValue = rCla.claAllSearch(colname, colvalue);
			if (colValue == null) {
				this.dispose();
				JOptionPane.showMessageDialog(null, "没有符合条件的记录");
			} else {
				jTabClaInfo = new JTable(colValue, colName);
				jScrollPanel = new JScrollPane(jTabClaInfo);
				this.getContentPane().add(jScrollPanel, BorderLayout.CENTER);
				this.pack();
				this.setVisible(true);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public ResultClass(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);
		ClaBean rCla = new ClaBean();
		try {
			colValue = rCla.claAllSearch(sColName, sFromValue, sToValue);
			if (colValue == null) {
				this.dispose();
				JOptionPane.showMessageDialog(null, "没有符合条件的记录");
			} else {
				jTabClaInfo = new JTable(colValue, colName);
				jScrollPanel = new JScrollPane(jTabClaInfo);
				this.getContentPane().add(jScrollPanel, BorderLayout.CENTER);
				this.pack();
				this.setVisible(true);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?