?? resultstudent.java
字號:
package Cstudent;
import java.awt.*;
import java.sql.*;
import javax.swing.*;
import javax.swing.table.*;
import java.util.*;
import java.awt.event.*;
import java.net.*;
/**
* 顯示學生查詢模塊查詢結(jié)果的類
*/
public class ResultStudent extends JFrame {
JLabel jLabel1 = new JLabel();
JButton jBExit = new JButton();
JScrollPane jScrollPane1 ;
JTable jTabStuInfo;
String sNum;
String[] colName = {"學號","姓名","性別","年齡","所在院系"};
String[][] colValue;
String sColValue;
String sColName;
String sFromValue;
String sToValue;
public ResultStudent(String colname,String colvalue) {
this.sColValue = colvalue;
this.sColName = colname;
this.setTitle("學生信息查詢結(jié)果");
//設(shè)置程序圖標
//this.setIconImage(getImage("icon.gif"));
//設(shè)置運行位置,使對話框居中
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation( (int) (screenSize.width - 400) / 2 ,
(int) (screenSize.height - 300) / 2 + 45);
StuBean rStu = new StuBean();
try {
colValue = rStu.stuAllSearch(sColName,sColValue);
if(colValue == null){
JOptionPane.showMessageDialog(null, "沒有符合條件的記錄");
this.dispose();
}
else{
jTabStuInfo = new JTable(colValue,colName);
jScrollPane1 = new JScrollPane(jTabStuInfo);
this.getContentPane().add(jScrollPane1,BorderLayout.CENTER);
this.pack();
this.setVisible(true);
}
}
catch(Exception e) {
e.printStackTrace();
}
}
public ResultStudent(String colname,String fromvalue,String tovalue) {
this.sColName = colname;
this.sFromValue = fromvalue;
this.sToValue = tovalue;
this.setTitle("學生信息查詢結(jié)果");
//this.setIconImage(getImage("icon.gif"));
//設(shè)置運行位置,使對話框居中
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation( (int) (screenSize.width - 400) / 2 ,
(int) (screenSize.height - 300) / 2 + 45);
StuBean rStu = new StuBean();
try {
colValue = rStu.stuAllSearch(sColName,sFromValue,sToValue);
if(colValue == null){
this.dispose();
JOptionPane.showMessageDialog(null, "沒有符合條件的記錄");
}
else{
jTabStuInfo = new JTable(colValue,colName);
jScrollPane1 = new JScrollPane(jTabStuInfo);
this.getContentPane().add(jScrollPane1,BorderLayout.CENTER);
this.pack();
this.setVisible(true);
}
}
catch(Exception e) {
e.printStackTrace();
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -