📄 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 + -