📄 classmagdialog.java
字号:
package com.hb.stumanagesys.basicinfomaintain;
import com.cloudgarden.layout.AnchorConstraint;
import com.cloudgarden.layout.AnchorLayout;
import com.hb.jdbcconnct.JdbcConnct;
import com.hb.stumanagesys.basicinfomaintain.CourseMagDialog.Course;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.sql.SQLException;
import java.util.Vector;
import javax.swing.ButtonGroup;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
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.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ListModel;
import javax.swing.SwingConstants;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
/**
* 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 ClassMagDialog extends javax.swing.JDialog {
private JPanel ClassMagPanel;
private JLabel ClassIdLabel;
private JLabel ClassNameLabel;
private JLabel TeacherIdLabel;
private JTextField FlagYearTextField;
private JButton DeleteButton;
private JTable ClassQueryTable;
private JScrollPane ClassQueryScrollPane;
private JButton DistriStuButton;
private JButton ClassQueryButton;
private JTextField ClassQueryTextField;
private JComboBox QueryComboBox;
private JTabbedPane ClassMagTabbedPane;
private ButtonGroup logicSelectbuttonGroup;
private JButton AddButton;
private JButton ClearButton;
private JList QueryConditionList1;
private JRadioButton OrRadioButton;
private JTextField EndTextField;
private JLabel RageLabel;
private JTextField FirstTextField;
private JCheckBox SelectRageCheckBox1;
private JComboBox CompareComboBox;
private JPanel DataViewPanel1;
private JPanel QueryPanel;
private JSeparator VSeparator1;
private JLabel majorIdLabel;
private JButton ExitButton;
private JSeparator ClassMagSeparator;
private ButtonGroup QuerybuttonGroup;
private JRadioButton FaintRadioButton;
private JRadioButton PrecisionRadioButton;
private JLabel QueryClassLabel;
private JButton SaveButton;
private JButton ModifyButton;
private JButton NewButton;
private JLabel FlagYearLabel;
private JTextField StuNumTextField;
private JLabel StuNumLabel;
private JTextField TeacherIdTextField;
private JTextField ClassNameTextField;
private JTextField ClassIdTextField;
private JTextField majorIDTextField;
// 定义Class对象
Class newclass = new Class();
// 定义默认表格模型
protected DefaultTableModel ClassQueryTableModel;
protected DefaultTableModel infoTable1Model;// 显示查询信息的表格模型
// 定义ClassQueryTable表格使用变量,标题column[],数据row[]
private String[][] row;
private String[] column = { "班级号", "班级名", "班主任ID", "班主任名", "专业号", "专业名", "学生人数", "界别" };
private String[] column1 = { "", "", "", "", "" };
// 定义ComboBox使用变量 查询字段
private String[] combList = { "班级号", "班级名", "班主任名", "学生人数", "界别" };
// 判断条件
private String[] comCompareList = { ">", "<", "=" };
// 定义List显示变量 vecListView
public Vector vecListView = new Vector(20);
private JTextField jTextField1;
private JTextField jTextField2;
// 定义SQL多条件查询变量
public Vector vecSQL = new Vector(20);
// 定义用户查询条件数量初始化为1
int ncount = 1;
// 判定输入格式,定义正则表达式
// 定义界别正则表达式四位数字,第一位不为空的四位年份2008,1999
public final static String REG_DIGFlagYear = "[1-9]\\d{3}";
// 定义班级号,学生人数正则表达式6位数字,第一位不能为空
public final static String REG_DIGIT = "[1-9]\\d{0,6}";
// 定义教师编号正则表达式,四位数字第一位不为0,1到9999
public final static String REG_DIGITTEACH = "[1-9]\\d{0,3}";
public final static String REG_FLOATHOUR = "\\d{1}\\.?\\d{0,1}";
/**
* Auto-generated main method to display this JDialog
*/
public static void main(String[] args) {
JFrame frame = new JFrame();
ClassMagDialog inst = new ClassMagDialog(frame);
inst.setVisible(true);
inst.setLocationRelativeTo(null);
}
public ClassMagDialog(JFrame frame) {
super(frame);
initGUI();
this.initTable();
}
private void initGUI() {
try {
{
getContentPane().setLayout(null);
this.setTitle("\u73ed\u7ea7\u7ba1\u7406");
{
{
QuerybuttonGroup = new ButtonGroup();
}
{
logicSelectbuttonGroup = new ButtonGroup();
}
ClassMagPanel = new JPanel();
getContentPane().add(ClassMagPanel);
ClassMagPanel.setBounds(0, 0, 903, 455);
ClassMagPanel.setLayout(null);
ClassMagPanel.setBackground(new java.awt.Color(185, 185,
255));
{
ClassIdLabel = new JLabel();
ClassMagPanel.add(ClassIdLabel);
ClassIdLabel.setText("\u73ed\u7ea7\u53f7");
ClassIdLabel.setBounds(707, 28, 63, 28);
}
{
ClassNameLabel = new JLabel();
ClassMagPanel.add(ClassNameLabel);
ClassNameLabel.setText("\u73ed\u7ea7\u540d");
ClassNameLabel.setBounds(707, 63, 63, 28);
}
{
ClassIdTextField = new JTextField();
ClassMagPanel.add(ClassIdTextField);
ClassIdTextField.setText("\u73ed\u7ea7\u7f16\u53f7");
ClassIdTextField.setBounds(770, 28, 105, 28);
}
{
ClassNameTextField = new JTextField();
ClassMagPanel.add(ClassNameTextField);
ClassNameTextField
.setText("\u8bf7\u8f93\u5165\u73ed\u7ea7\u540d");
ClassNameTextField.setBounds(770, 63, 105, 28);
}
{
TeacherIdLabel = new JLabel();
ClassMagPanel.add(TeacherIdLabel);
TeacherIdLabel.setText("\u5bfc\u5e08\u5de5\u53f7");
TeacherIdLabel.setBounds(707, 98, 63, 28);
}
{
TeacherIdTextField = new JTextField();
ClassMagPanel.add(TeacherIdTextField);
TeacherIdTextField
.setText("\u8bf7\u8f93\u5165\u5bfc\u5e08\u5de5\u53f7");
TeacherIdTextField.setBounds(770, 98, 105, 28);
}
{
majorIdLabel = new JLabel();
ClassMagPanel.add(majorIdLabel);
majorIdLabel.setText("\u4e13\u4e1a\u53f7");
majorIdLabel.setBounds(707, 133, 56, 28);
}
{
StuNumLabel = new JLabel();
ClassMagPanel.add(StuNumLabel);
StuNumLabel.setText("\u5b66\u751f\u4eba\u6570");
StuNumLabel.setBounds(707, 168, 63, 28);
}
{
StuNumTextField = new JTextField();
ClassMagPanel.add(StuNumTextField);
StuNumTextField
.setText("\u8bf7\u8f93\u5165\u5b66\u751f\u4eba\u6570");
StuNumTextField.setBounds(770, 168, 105, 28);
}
{
majorIDTextField = new JTextField();
ClassMagPanel.add(majorIDTextField);
majorIDTextField
.setText("\u8bf7\u8f93\u5165\u4e13\u4e1a\u53f7");
majorIDTextField.setBounds(770, 133, 105, 28);
majorIDTextField.setBounds(770, 133, 105, 28);
}
{
FlagYearLabel = new JLabel();
ClassMagPanel.add(FlagYearLabel);
FlagYearLabel.setText("\u5c4a\u522b");
FlagYearLabel.setBounds(707, 203, 63, 28);
}
{
FlagYearTextField = new JTextField();
ClassMagPanel.add(FlagYearTextField);
FlagYearTextField
.setText("\u8bf7\u8f93\u5165\u5c4a\u522b");
FlagYearTextField.setBounds(770, 203, 105, 28);
}
{
NewButton = new JButton();
ClassMagPanel.add(NewButton);
NewButton.setText("\u65b0\u589e");
NewButton.setBounds(693, 252, 70, 21);
NewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
NewButtonActionPerformed(evt);
}
});
}
{
ModifyButton = new JButton();
ClassMagPanel.add(ModifyButton);
ModifyButton.setText("\u4fee\u6539");
ModifyButton.setBounds(798, 252, 70, 21);
ModifyButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
ModifyButtonActionPerformed(evt);
}
});
}
{
DeleteButton = new JButton();
ClassMagPanel.add(DeleteButton);
DeleteButton.setText("\u5220\u9664");
DeleteButton.setBounds(693, 287, 70, 21);
DeleteButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
DeleteButtonActionPerformed(evt);
}
});
}
{
SaveButton = new JButton();
ClassMagPanel.add(SaveButton);
SaveButton.setText("\u4fdd\u5b58");
SaveButton.setBounds(798, 287, 70, 21);
SaveButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
SaveButtonActionPerformed(evt);
}
});
}
{
DistriStuButton = new JButton();
ClassMagPanel.add(DistriStuButton);
DistriStuButton.setText("\u5206\u914d\u5b66\u751f");
DistriStuButton.setBounds(777, 322, 91, 21);
DistriStuButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
DistriStuButtonActionPerformed(evt);
}
});
}
{
ClassMagSeparator = new JSeparator();
ClassMagPanel.add(ClassMagSeparator);
ClassMagSeparator.setBounds(665, 357, 231, 91);
}
{
ExitButton = new JButton();
ClassMagPanel.add(ExitButton);
ExitButton.setText("\u9000\u51fa");
ExitButton.setBounds(791, 378, 70, 21);
ExitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
ExitButtonActionPerformed(evt);
}
});
}
{
VSeparator1 = new JSeparator();
ClassMagPanel.add(VSeparator1);
VSeparator1.setBounds(665, 0, 231, 448);
VSeparator1.setOrientation(SwingConstants.VERTICAL);
}
{
ClassMagTabbedPane = new JTabbedPane();
ClassMagPanel.add(ClassMagTabbedPane);
ClassMagTabbedPane.setBounds(21, 14, 574, 399);
{
QueryPanel = new JPanel();
ClassMagTabbedPane.addTab("班级查询", null, QueryPanel,
null);
QueryPanel.setLayout(null);
QueryPanel.setSize(569, 373);
QueryPanel.setPreferredSize(new java.awt.Dimension(
569, 373));
{
QueryClassLabel = new JLabel();
QueryPanel.add(QueryClassLabel);
QueryClassLabel
.setText("\u67e5\u8be2\u6761\u4ef6");
QueryClassLabel.setBounds(21, 140, 35, 28);
QueryClassLabel.setSize(84, 21);
QueryClassLabel
.setForeground(new java.awt.Color(0, 0,
255));
}
{
PrecisionRadioButton = new JRadioButton();
QueryPanel.add(PrecisionRadioButton);
PrecisionRadioButton.setText("\u65e0");
PrecisionRadioButton.setBounds(21, 112, 49, 21);
QuerybuttonGroup.add(PrecisionRadioButton);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -