?? scoreuniversquerydialog.java
字號:
package com.hb.stumanagesys.universquery;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Vector;
import javax.swing.ButtonGroup;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ListModel;
import javax.swing.SpinnerListModel;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import com.hb.jdbcconnct.JdbcConnct;
/**
* This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
* Builder, which is free for non-commercial use. If Jigloo is being used
* commercially (ie, by a corporation, company or business for any purpose
* whatever) then you should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details. Use of Jigloo implies
* acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
* PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
* ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class ScoreUniversQueryDialog extends javax.swing.JDialog {
private JPanel ScoreQueryPanel;
private JTabbedPane ScorQueryTabbedPane;
private JScrollPane stuScroeScrollPane;
private JTable ClassQueryTable;
private JScrollPane ClassQueryScrollPane1;
private JButton addButton;
private JButton clearButton;
private JButton classQueryButton;
private JList ClassQueryList;
private JScrollPane jScrollPane1;
private JRadioButton orRadioButton;
private JRadioButton addRadioButton;
private JRadioButton nullRadioButton;
private JTextField commentTextField;
private JComboBox classQueryConditionComboBox;
private JComboBox ClassQueryComboBox;
private JButton addStuQueryButton;
private JButton clearStuQueryButton;
private JButton studentQueryButton1;
private JList studentQueryList1;
private JTable stuScoreTable;
private JRadioButton orRadioButton1;
private JRadioButton andRadioButton1;
private JRadioButton nullRadioButton1;
private JTextField userInputTextField1;
private JComboBox compareComboBox;
private JComboBox queryConditionComboBox;
private JButton exitButton;
private JSeparator HorSeparator1;
private JSeparator VSeparator;
private JButton classScoreQueryButton;
private JComboBox subjectConditionComboBox;
private ButtonGroup classQuerybuttonGroup;
private JRadioButton subjectQueryRadioButton;
private JRadioButton fullSubjectQueryRadioButton;
private JLabel classNameViewLabel;
private JLabel classNameLabel;
private JLabel classIdViewLabel;
private JLabel classIdLabel;
private ButtonGroup scoreQuerybuttonGroup;
private JRadioButton commonRadioButton;
private JRadioButton fullQueryRadioButton;
private JLabel stuQueryViewLabel;
private JButton studentQueryButton;
private JComboBox conditionComboBox;
private JSpinner yearSelectSpinner;
private JPanel classQueryPanel;
private JPanel dataViewPanel;
private JPanel queryResultPanel;
private JPanel studentQueryPanel;
// 定義學生\班級查詢默認表格模型 DefaultTableModel ClassQueryTableModel;
// 定義學生成績查詢默認表格模型 DefaultTableModel stuScoreTableModel;
// 定義table表格使用變量,標題column[],數據row[]
private String[][] row;
private String[] column = { "學號", "姓名", "考試日期", "成績" };
// 定義ComboBox使用變量 學生查詢字段 private String[] combListStu = { "學號", "姓名", "年齡", "班主任名" };
// 定義ComboBox使用變量 班級查詢字段 private String[] combListClass = { "班級號", "班級名", "屆別" };
// 定義Table使用變量 班級查詢字段 private String[] columnClassQuery = { "班級號", "班級名", "專業號", "專業名", "屆別" };
// 定義ComboBox使用變量 科目查詢字段 private String[] combListSubject = { "大學英語", "高等數學", "計算機基礎",
"Java程序設計", "數據結構", "數據庫原理與應用"};
// 判斷條件 private String[] comCompareList = { ">", "<", "=" };
// 定義table表格使用變量,標題column[],數據row[]
// 班級成績查詢表字段 private String[] columnStudent = { "學號", "姓名", "科目號", "科目名", "考試時間",
"考試類型", "出勤狀態", "考試性質", "考試成績" };
// 學生成績查詢表字段 private String[] columnClass = { "學號", "姓名", "科目號", "科目名", "考試時間", "考試類型",
"出勤狀態", "考試性質", "考試成績" };
// 學生成績查詢條件 private String[] columnScoreQuery = { "上學期", "下學期" };
// 定義nowYear變量,獲取當前年 Date nowDate = new Date();
int nowYear = nowDate.getYear() + 1900;
// 定義SQL多條件查詢變量 public Vector vecSQL = new Vector(20);
// 定義List顯示變量 vecListView
public Vector vecListView = new Vector(20);
private ButtonGroup stuQuerybuttonGroup;
private ButtonGroup buttonGroup1;
// 定義SQL班級多條件查詢變量 public Vector vecSQLClass = new Vector(20);
// 定義List顯示變量 vecListViewClass
public Vector vecListViewClass = new Vector(20);
// 定義Vector變量 vsubject,存儲專業課程信息 public Vector vsubject = new Vector(200);
// 定義學生查詢條件數量初始化為1
int ncount = 1;
// 定義班級查詢條件數量初始化為1
int ncountClass = 1;
//定義int型變量 nclickNum,用戶點擊同一表格的次數 int nclickNum = 1;
// 定義查詢顯示queryView,用于向用戶顯示查詢信息 String strscoreQueryView = "";
// 定義學號正則表達式7位數字,第一位不能為空 public final static String REG_DIGIT = "[1-9]\\d{0,6}";
// 定義年齡正則表達式2位數字,第一位不能為空 public final static String REG_DIGITAGE = "[1-9]\\d{0,1}";
// 定義班級號正則表達式7位數字,第一位不能為空 public final static String REG_DIGITCLASS = "[1-9]\\d{0,6}";
// 定義屆別正則表達式4位數字,第一位不能為空 public final static String REG_DIGITFLAGYEAR = "[1-9]\\d{0,3}";
/**
* Auto-generated main method to display this JDialog
*/
public static void main(String[] args) {
JFrame frame = new JFrame();
ScoreUniversQueryDialog inst = new ScoreUniversQueryDialog(frame);
inst.setVisible(true);
// 設置對話框居中 inst.setLocationRelativeTo(null);
}
public ScoreUniversQueryDialog(JFrame frame) {
super(frame);
initGUI();
//隱藏學生成績查詢查詢按鈕
this.studentQueryButton.setVisible(false);
//隱藏學生成績查詢查詢按鈕 this.classScoreQueryButton.setVisible(false);
}
private void initGUI() {
try {
{
getContentPane().setLayout(null);
this.setTitle("\u6210\u7ee9\u67e5\u8be2");
this.setFont(new java.awt.Font("宋體", 0, 10));
{
{
scoreQuerybuttonGroup = new ButtonGroup();
}
{
classQuerybuttonGroup = new ButtonGroup();
}
{
buttonGroup1 = new ButtonGroup();
}
{
stuQuerybuttonGroup = new ButtonGroup();
}
ScoreQueryPanel = new JPanel();
getContentPane().add(ScoreQueryPanel);
ScoreQueryPanel.setBounds(0, 0, 896, 448);
ScoreQueryPanel.setForeground(new java.awt.Color(0, 0, 0));
ScoreQueryPanel.setBackground(new java.awt.Color(185, 185,
255));
ScoreQueryPanel.setLayout(null);
{
ScorQueryTabbedPane = new JTabbedPane();
ScoreQueryPanel.add(ScorQueryTabbedPane);
ScorQueryTabbedPane.setBounds(21, 21, 539, 385);
ScorQueryTabbedPane.setSize(546, 385);
ScorQueryTabbedPane.setFont(new java.awt.Font("Tahoma",
0, 12));
{
studentQueryPanel = new JPanel();
ScorQueryTabbedPane.addTab("學生查詢", null,
studentQueryPanel, null);
studentQueryPanel.setLayout(null);
studentQueryPanel
.setPreferredSize(new java.awt.Dimension(
539, 357));
studentQueryPanel.setFont(new java.awt.Font("Dialog",0,12));
{
ComboBoxModel queryConditionComboBoxModel = new DefaultComboBoxModel(
combListStu);
queryConditionComboBox = new JComboBox();
studentQueryPanel.add(queryConditionComboBox);
queryConditionComboBox
.setModel(queryConditionComboBoxModel);
queryConditionComboBox
.setBounds(21, 35, 91, 28);
queryConditionComboBox
.addActionListener(new ActionListener() {
public void actionPerformed(
ActionEvent evt) {
queryConditionComboBoxActionPerformed(evt);
}
});
}
{
ComboBoxModel compareComboBoxModel = new DefaultComboBoxModel(
comCompareList);
compareComboBox = new JComboBox();
studentQueryPanel.add(compareComboBox);
compareComboBox.setModel(compareComboBoxModel);
compareComboBox.setBounds(133, 35, 91, 28);
}
{
userInputTextField1 = new JTextField();
studentQueryPanel.add(userInputTextField1);
userInputTextField1
.setText("\u8bf7\u8f93\u5165\u67e5\u8be2\u4fe1\u606f");
userInputTextField1.setBounds(252, 35, 112, 28);
}
{
nullRadioButton1 = new JRadioButton();
studentQueryPanel.add(nullRadioButton1);
nullRadioButton1.setText("\u65e0");
nullRadioButton1.setSelected(true);
nullRadioButton1.setBounds(28, 77, 70, 21);
stuQuerybuttonGroup.add(nullRadioButton1);
}
{
andRadioButton1 = new JRadioButton();
studentQueryPanel.add(andRadioButton1);
andRadioButton1.setText("\u5e76\u4e14");
andRadioButton1.setBounds(98, 77, 70, 21);
stuQuerybuttonGroup.add(andRadioButton1);
}
{
orRadioButton1 = new JRadioButton();
studentQueryPanel.add(orRadioButton1);
orRadioButton1.setText("\u6216\u8005");
orRadioButton1.setBounds(168, 77, 70, 21);
stuQuerybuttonGroup.add(orRadioButton1);
}
{
ListModel studentQueryList1Model = new DefaultComboBoxModel();
studentQueryList1 = new JList();
studentQueryPanel.add(studentQueryList1);
studentQueryList1
.setModel(studentQueryList1Model);
studentQueryList1.setBounds(28, 112, 203, 161);
}
{
studentQueryButton1 = new JButton();
studentQueryPanel.add(studentQueryButton1);
studentQueryButton1.setText("\u67e5\u8be2");
studentQueryButton1.setBounds(14, 301, 70, 21);
studentQueryButton1
.addActionListener(new ActionListener() {
public void actionPerformed(
ActionEvent evt) {
studentQueryButton1ActionPerformed(evt);
}
});
}
{
clearStuQueryButton = new JButton();
studentQueryPanel.add(clearStuQueryButton);
clearStuQueryButton.setText("\u6e05\u7a7a");
clearStuQueryButton.setBounds(105, 301, 70, 21);
clearStuQueryButton
.addActionListener(new ActionListener() {
public void actionPerformed(
ActionEvent evt) {
clearStuQueryButtonActionPerformed(evt);
}
});
}
{
addStuQueryButton = new JButton();
studentQueryPanel.add(addStuQueryButton);
addStuQueryButton.setText("\u589e\u52a0");
addStuQueryButton.setBounds(189, 301, 70, 21);
addStuQueryButton
.addActionListener(new ActionListener() {
public void actionPerformed(
ActionEvent evt) {
addStuQueryButtonActionPerformed(evt);
}
});
}
}
{
classQueryPanel = new JPanel();
ScorQueryTabbedPane.addTab("班級查詢", null, classQueryPanel, null);
classQueryPanel.setLayout(null);
classQueryPanel.setFont(new java.awt.Font(
"Dialog",
0,
12));
classQueryPanel.setPreferredSize(new java.awt.Dimension(70, 358));
{
ComboBoxModel ClassQueryComboBoxModel = new DefaultComboBoxModel(
combListClass);
ClassQueryComboBox = new JComboBox();
classQueryPanel.add(ClassQueryComboBox);
ClassQueryComboBox
.setModel(ClassQueryComboBoxModel);
ClassQueryComboBox.setBounds(21, 35, 91, 28);
ClassQueryComboBox
.addActionListener(new ActionListener() {
public void actionPerformed(
ActionEvent evt) {
ClassQueryComboBoxActionPerformed(evt);
}
});
}
{
ComboBoxModel jComboBox1Model = new DefaultComboBoxModel(
comCompareList);
classQueryConditionComboBox = new JComboBox();
classQueryPanel
.add(classQueryConditionComboBox);
classQueryConditionComboBox
.setModel(jComboBox1Model);
classQueryConditionComboBox.setBounds(133, 35, 91, 28);
}
{
commentTextField = new JTextField();
classQueryPanel.add(commentTextField);
commentTextField
.setText("\u8f93\u5165\u67e5\u8be2\u6761\u4ef6");
commentTextField.setBounds(252, 35, 112, 28);
}
{
nullRadioButton = new JRadioButton();
classQueryPanel.add(nullRadioButton);
nullRadioButton.setText("\u65e0");
nullRadioButton.setSelected(true);
nullRadioButton.setBounds(28, 77, 63, 28);
nullRadioButton.setSize(70, 21);
buttonGroup1.add(nullRadioButton);
}
{
addRadioButton = new JRadioButton();
classQueryPanel.add(addRadioButton);
addRadioButton.setText("\u5e76");
addRadioButton.setBounds(98, 77, 70, 21);
buttonGroup1.add(addRadioButton);
}
{
orRadioButton = new JRadioButton();
classQueryPanel.add(orRadioButton);
orRadioButton.setText("\u6216");
orRadioButton.setBounds(168, 77, 70, 21);
buttonGroup1.add(orRadioButton);
}
{
jScrollPane1 = new JScrollPane();
classQueryPanel.add(jScrollPane1);
jScrollPane1.setBounds(28, 112, 203, 161);
{
ListModel ClassQueryListModel = new DefaultComboBoxModel();
ClassQueryList = new JList();
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -