?? resultgrade.java
字號:
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 ResultGrade extends JFrame {
JLabel jLabel1 = new JLabel();
JButton jBExit = new JButton();
JScrollPane jScrollPane1 ;
JTable jTabStuInfo;
String sNum;
String[] colName = {"學(xué)號","姓名","課程號","課程名稱","成績"};
String[][] colValue;
public ResultGrade(String sNum) {
this.setTitle("成績查詢結(jié)果");
//設(shè)置程序圖標(biāo)
this.setIconImage(getImage("icon.gif"));
//設(shè)置運(yùn)行位置,使對話框居中
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
this.setLocation( (int) (screenSize.width - 400) / 2 ,
(int) (screenSize.height - 300) / 2 + 45);
this.sNum = sNum;
csBean rGrade = new csBean();
try {
colValue = rGrade.csAllSearch(sNum,5);
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) {
}
}
/**
* 通過給定的文件名獲得圖像
*/
Image getImage(String filename) {
URLClassLoader urlLoader = (URLClassLoader)this.getClass().
getClassLoader();
URL url = null;
Image image = null;
url = urlLoader.findResource(filename);
image = Toolkit.getDefaultToolkit().getImage(url);
MediaTracker mediatracker = new MediaTracker(this);
try {
mediatracker.addImage(image, 0);
mediatracker.waitForID(0);
}
catch (InterruptedException _ex) {
image = null;
}
if (mediatracker.isErrorID(0)) {
image = null;
}
return image;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -