?? selectexamdialog.java
字號:
package com.hb.stumanagesys.universquery;
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.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.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ListModel;
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 SelectExamDialog extends javax.swing.JDialog {
private JPanel examQueryPanel;
private JTable examQueryTable;
private DefaultTableModel examSelModel = new DefaultTableModel();
private JButton exitButton;
private JButton clearExamQueryButton;
private JButton addExamQueryButton;
private JList studentQueryList1;
private JRadioButton nullRadioButton1;
private JRadioButton andRadioButton1;
private JRadioButton orRadioButton1;
private JComboBox logicSymbloComboBox;
private JPanel dataViewPanel;
private JPanel jPanel1;
private JTabbedPane examQueryTabbedPane;
private JComboBox examQueryTypeComboBox;
private JButton selectButton;
private JTextField userInputTextField;
private JScrollPane examQueryScrollPane;
//考試表表頭
private String[] columnExam = { "科目號", "科目名", "監考教師工號", "監考人姓名", "開始時間",
"結束時間", "考試地點", "考試類型", "參考人數", "備注" };
//考試表信息顯示
private String[][] row;
//考試表表格模型
DefaultTableModel examQueryTableModel;
// 判斷條件
private String[] comCompareList = { ">", "<", "=" };
// 定義SQL多條件查詢變量
public Vector vecSQL = new Vector(20);
// 定義List顯示變量 vecListView
public Vector vecListView = new Vector(20);
private ButtonGroup examQuerybuttonGroup;
// 定義考試查詢條件數量初始化為1
int ncountExam = 1;
// 定義科目號正則表達式7位數字,第一位不能為空
public final static String REG_DIGITCOURSE = "[1-9]\\d{0,6}";
/**
* Auto-generated main method to display this JDialog
*/
public static void main(String[] args) {
JFrame frame = new JFrame();
SelectExamDialog inst = new SelectExamDialog(frame);
inst.setVisible(true);
//設置對話框居中
inst.setLocationRelativeTo(null);
}
public SelectExamDialog(JFrame frame) {
super(frame);
initGUI();
}
private void initGUI() {
try {
this.setTitle("考試安排綜合查詢");
{
{
examQuerybuttonGroup = new ButtonGroup();
}
examQueryPanel = new JPanel();
getContentPane().add(examQueryPanel, BorderLayout.CENTER);
examQueryPanel.setLayout(null);
examQueryPanel.setBackground(new java.awt.Color(170, 173, 242));
examQueryPanel.setPreferredSize(new java.awt.Dimension(861, 441));
{
examQueryTabbedPane = new JTabbedPane();
examQueryPanel.add(examQueryTabbedPane);
examQueryTabbedPane.setBounds(21, 21, 539, 406);
{
jPanel1 = new JPanel();
examQueryTabbedPane.addTab("考試查詢", null, jPanel1, null);
jPanel1.setLayout(null);
{
ComboBoxModel jComboBox1Model = new DefaultComboBoxModel(
new String[] { "科目號", "科目名" });
examQueryTypeComboBox = new JComboBox();
jPanel1.add(examQueryTypeComboBox);
examQueryTypeComboBox.setModel(jComboBox1Model);
examQueryTypeComboBox.setBounds(21, 14, 70, 28);
examQueryTypeComboBox
.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
examQueryTypeComboBoxActionPerformed(evt);
}
});
}
{
userInputTextField = new JTextField();
jPanel1.add(userInputTextField);
userInputTextField.setBounds(189, 14, 84, 28);
}
{
selectButton = new JButton();
jPanel1.add(selectButton);
selectButton.setText("\u67e5\u8be2");
selectButton.setBounds(21, 301, 70, 21);
selectButton
.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
selectButtonActionPerformed(evt);
}
});
}
{
exitButton = new JButton();
jPanel1.add(exitButton);
exitButton.setText("\u9000\u51fa");
exitButton.setBounds(420, 322, 63, 28);
exitButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
exitButtonActionPerformed(evt);
}
});
}
{
ComboBoxModel jComboBox2Model = new DefaultComboBoxModel(
this.comCompareList);
logicSymbloComboBox = new JComboBox();
jPanel1.add(logicSymbloComboBox);
logicSymbloComboBox.setModel(jComboBox2Model);
logicSymbloComboBox.setBounds(105, 14, 70, 28);
}
{
orRadioButton1 = new JRadioButton();
jPanel1.add(orRadioButton1);
orRadioButton1.setText("\u6216\u8005");
orRadioButton1.setBounds(168, 77, 70, 21);
examQuerybuttonGroup.add(orRadioButton1);
}
{
andRadioButton1 = new JRadioButton();
jPanel1.add(andRadioButton1);
andRadioButton1.setText("\u5e76\u4e14");
andRadioButton1.setBounds(98, 77, 70, 21);
examQuerybuttonGroup.add(andRadioButton1);
}
{
nullRadioButton1 = new JRadioButton();
jPanel1.add(nullRadioButton1);
nullRadioButton1.setText("\u65e0");
nullRadioButton1.setSelected(true);
nullRadioButton1.setBounds(28, 77, 70, 21);
examQuerybuttonGroup.add(nullRadioButton1);
}
{
ListModel studentQueryList1Model = new DefaultComboBoxModel(
);
studentQueryList1 = new JList();
jPanel1.add(studentQueryList1);
studentQueryList1.setModel(studentQueryList1Model);
studentQueryList1.setBounds(28, 112, 203, 161);
}
{
addExamQueryButton = new JButton();
jPanel1.add(addExamQueryButton);
addExamQueryButton.setText("\u589e\u52a0");
addExamQueryButton.setBounds(189, 301, 70, 21);
addExamQueryButton
.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
addExamQueryButtonActionPerformed(evt);
}
});
}
{
clearExamQueryButton = new JButton();
jPanel1.add(clearExamQueryButton);
clearExamQueryButton.setText("\u6e05\u7a7a");
clearExamQueryButton.setBounds(105, 301, 70, 21);
clearExamQueryButton
.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
clearExamQueryButtonActionPerformed(evt);
}
});
}
}
{
dataViewPanel = new JPanel();
examQueryTabbedPane.addTab("查詢結果", null, dataViewPanel, null);
dataViewPanel.setLayout(null);
{
examQueryScrollPane = new JScrollPane();
dataViewPanel.add(examQueryScrollPane);
examQueryScrollPane.setBounds(14, 28, 490, 343);
{
examQueryTableModel = new DefaultTableModel(
row,
columnExam);
examQueryTable = new JTable();
examQueryScrollPane
.setViewportView(examQueryTable);
examQueryTable.setModel(examQueryTableModel);
examQueryTable.setBounds(14, 14, 742, 399);
examQueryTable.setRowHeight(24);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -