⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wmstupsycomdialog.java

📁 学生管理系统。使用java编程
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
package com.hb.stumanagesys.basicinfomaintain;
import com.cloudgarden.layout.AnchorConstraint;
import com.cloudgarden.layout.AnchorLayout;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Calendar;
import java.util.Date;
import java.util.Vector;
import javax.swing.BorderFactory;

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.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.BevelBorder;
import javax.swing.border.LineBorder;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableModel;
import javax.swing.JOptionPane;
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 wmStuPsyComDialog extends javax.swing.JDialog {
	private JPanel wmStuPsyComPanel; //定义心理学习评论面板
	private JComboBox wmStuPsyComComboBox;//定义学期查询下拉框
	private JButton deleteButton;//定义退出按钮
	private JButton commitButton;//定义修改按钮
	private JButton addButton;//定义添加按钮
	private JButton querButton; //定义查询按钮
	private JComboBox fullComboBox;//定义查询条件下拉框
	private JLabel anLabel;// 按Label
	private JScrollPane psyScrollPane;//带滚动条的按钮 
	private JTextArea psyTextArea; //心理评论文本域
	private JLabel psyLabel; //心理评论Label
	private JScrollPane stuScrollPane;//定义带滚动条的面板学习评论
	private JTextArea stuTextArea;//定义学习评论文本域
	private JLabel stuLabel; //定义学习评论Label
	private JLabel commentLabel;//评论Label
	private JComboBox spComboBox;//定义心理/学习下拉框
	private JTable commentTable;//定义评论信息表格
	private JComboBox termComboBox;//定义添加/修改学期下拉框
	private JCheckBox mixCheckBox;//定义模糊查询复选框
	private JSeparator wmSeparator;//定义JSeparator
	private JPanel showTablePanel1;//定义showTable面板
	private JButton okButton;//定义提交按钮
	private JLabel contLabel1;//定义第Label
	private JComboBox numComboBox1;//周月数下拉框
	private JComboBox weekormonComboBox;//周月选项下拉框
	private JSeparator jSeparator1;//定义jSeparator
	private JComboBox yeartermComboBox;//定义添加/修改学年选项
	private JTextField teachernameTextField1;//定义老师姓名文本框
	private JLabel teachernameLabel1;//定义老师姓名Label
	private JTextField stunameTextField;//定义学生姓名文本框
	private JLabel stunameLabel;//定义学生姓名Label
	private JTextField teacherTextField1;//定义老师工号文本框
	private JLabel teacheridLabel;//定义老师工号Label
	private JTextField stuidTextField;//定义学生学号文本框
	private JLabel studentid;//定义学生学号Label
	private JScrollPane commentScrollPane;//定义带滚动条的面板
	private JTextField inputTextField;//定义查询条件输入文本框
	private JButton exsitButton;//定义退出按钮
	private JComboBox wmComboBox;//定义周月选项下拉框
	//DefaultTableModel dataModel;
	DefaultComboBoxModel numComboBox1Model;//定义表格的Model
	DefaultTableModel commentTableModel;//定义表格的Model
	JdbcConnct jdbc = new JdbcConnct();//创建并实例化连接类的对象
	 Date date = new Date();//创建日期类对象
	 ComboBoxModel yeartermComboBoxModel;//定义学年下拉框的Model
	 ComboBoxModel wmStuPsyComComboBoxModel;//定义下拉框的Model
	 String chyearterm []=new String[20];//定义数组用来存放修改时候的学年信息
	 String addyearterm []=new String[10];//定义数组用来存放添加时候的学年信息
	 String queryYearTerm[] = new String[21];//定义数组用来存放查询时候的学期信息
	
	/**
	* Auto-generated main method to display this JDialog
	* 入口函数
	*/
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		wmStuPsyComDialog inst = new wmStuPsyComDialog(frame);
		inst.setVisible(true);
		inst.setLocationRelativeTo(null);
		inst.setResizable(false);	
	}
	/**
	 * 构造函数
	 * @param frame
	 */
	public wmStuPsyComDialog(JFrame frame) {
		super(frame);
		initGUI();
	}
	/**
	 * 图形界面实现方法
	 *
	 */
	private void initGUI() {
		try {
			{
				getContentPane().setLayout(null);
				this.setTitle("\u5b66\u4e60\u5fc3\u7406\u60c5\u51b5\u8bc4\u8bba");
			}
			{
				wmStuPsyComPanel = new JPanel();
				getContentPane().add(wmStuPsyComPanel);
				wmStuPsyComPanel.setLayout(null);
				wmStuPsyComPanel.setBackground(new java.awt.Color(185,185,255));
				wmStuPsyComPanel.setBounds(581, 0, 329, 469);
				{
					addButton = new JButton();
					wmStuPsyComPanel.add(addButton);
					addButton.setText("\u6dfb\u52a0");
					addButton.setBounds(28, 371, 70, 28);
					addButton.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							addButtonActionPerformed(evt);
						}
					});
				}
				{
					commitButton = new JButton();
					wmStuPsyComPanel.add(commitButton);
					commitButton.setText("\u7f16\u8f91");
					commitButton.setBounds(105, 371, 70, 28);
					commitButton.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							commitButtonActionPerformed(evt);
						}
					});
				}
				{
					deleteButton = new JButton();
					wmStuPsyComPanel.add(deleteButton);
					deleteButton.setText("\u5220\u9664");
					deleteButton.setBounds(252, 371, 63, 28);
					deleteButton.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							deleteButtonActionPerformed(evt);
						}
					});
				}
				{
					stuLabel = new JLabel();
					wmStuPsyComPanel.add(stuLabel);
					stuLabel.setText("\u5b66\u4e60\u60c5\u51b5\u8bc4\u8bba");
					stuLabel.setBounds(21, 112, 105, 28);
				}
				{
					stuScrollPane = new JScrollPane();
					wmStuPsyComPanel.add(stuScrollPane);
					stuScrollPane.setBounds(56, 136, 238, 63);
					stuScrollPane.setBorder(new LineBorder(new java.awt.Color(185,185,255), 1, false));
					{
						stuTextArea = new JTextArea();
						stuScrollPane.setViewportView(stuTextArea);
						stuTextArea.setBounds(271, 210, 124, 100);
						stuTextArea.setPreferredSize(new java.awt.Dimension(219, 74));
					}
				}
				{
					psyLabel = new JLabel();
					wmStuPsyComPanel.add(psyLabel);
					psyLabel.setText("\u5fc3\u7406\u60c5\u51b5\u8bc4\u8bba");
					psyLabel.setBounds(21, 196, 112, 28);
				}
				{
					psyScrollPane = new JScrollPane();
					wmStuPsyComPanel.add(psyScrollPane);
					psyScrollPane.setBounds(56, 224, 238, 70);
					{
						psyTextArea = new JTextArea();
						psyScrollPane.setViewportView(psyTextArea);
						psyTextArea.setBounds(42, 343, 168, 91);
						psyTextArea.setPreferredSize(new java.awt.Dimension(220, 73));
						psyTextArea.setBorder(new LineBorder(new java.awt.Color(185,185,255), 1, false));
					}
				}
				{
					exsitButton = new JButton();
					wmStuPsyComPanel.add(exsitButton);
					exsitButton.setText("\u9000\u51fa");
					exsitButton.setBounds(252, 413, 70, 28);
					exsitButton.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							exsitButtonActionPerformed(evt);
						}
					});
				}
				{
					studentid = new JLabel();
					wmStuPsyComPanel.add(studentid);
					studentid.setText("\u5b66\u53f7");
					studentid.setBounds(21, 77, 63, 28);
				}
				{
					stuidTextField = new JTextField();
					wmStuPsyComPanel.add(stuidTextField);
					stuidTextField.setBounds(56, 77, 77, 28);
					stuidTextField.setBorder(new LineBorder(new java.awt.Color(185,185,255), 1, false));
				}
				{
					teacheridLabel = new JLabel();
					wmStuPsyComPanel.add(teacheridLabel);
					teacheridLabel.setText("\u6559\u5e08\u5de5\u53f7");
					teacheridLabel.setBounds(28, 308, 77, 28);
				}
				{
					teacherTextField1 = new JTextField();
					wmStuPsyComPanel.add(teacherTextField1);
					teacherTextField1.setBounds(84, 308, 77, 28);
					teacherTextField1.setBorder(new LineBorder(new java.awt.Color(185,185,255), 1, false));
				}
				{
					stunameLabel = new JLabel();
					wmStuPsyComPanel.add(stunameLabel);
					stunameLabel.setText("\u5b66\u751f\u59d3\u540d");
					stunameLabel.setBounds(140, 77, 77, 28);
				}
				{
					stunameTextField = new JTextField();
					wmStuPsyComPanel.add(stunameTextField);
					stunameTextField.setBounds(196, 77, 84, 28);
					stunameTextField.setBorder(new LineBorder(new java.awt.Color(185,185,255), 1, false));
					stunameTextField.setEditable(false);
				}
				{
					teachernameLabel1 = new JLabel();
					wmStuPsyComPanel.add(teachernameLabel1);
					teachernameLabel1.setBounds(168, 308, 70, 28);
					teachernameLabel1.setText("\u6559\u5e08\u59d3\u540d");
				}
				{
					teachernameTextField1 = new JTextField();
					wmStuPsyComPanel.add(teachernameTextField1);
					teachernameTextField1.setBounds(224, 308, 84, 28);
					teachernameTextField1.setBorder(new LineBorder(new java.awt.Color(185,185,255), 1, false));
					teachernameTextField1.setEditable(false);
				}
				{
					for(int nowYear=date.getYear()+1900,i=0;nowYear<date.getYear()+1910;nowYear++,i++)
					{
						int afterYear = nowYear+1;
						addyearterm[i]= nowYear+"~"+afterYear+"学年";
					//System.out.println(yearterm[i]);
					}
					 yeartermComboBoxModel = new DefaultComboBoxModel(addyearterm);
						//new String[] {"2007~2008学年上学期", "2007~2008学年下学期","2008~2009学年上学期","2008~2009学年下学期"  });
					yeartermComboBox = new JComboBox();
					wmStuPsyComPanel.add(yeartermComboBox);
					yeartermComboBox.setModel(yeartermComboBoxModel);
					yeartermComboBox.setBounds(14, 21, 119, 28);
				}
				{
					jSeparator1 = new JSeparator();
					wmStuPsyComPanel.add(jSeparator1);
					jSeparator1.setBounds(7, 357, 315, 7);
				}
				{
					ComboBoxModel weekormonComboBoxModel = new DefaultComboBoxModel(
						new String[] { "周", "月" });
					weekormonComboBox = new JComboBox();
					wmStuPsyComPanel.add(weekormonComboBox);
					weekormonComboBox.setModel(weekormonComboBoxModel);
					weekormonComboBox.setBounds(266, 21, 49, 28);
					weekormonComboBox.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							weekormonComboBoxActionPerformed(evt);
						}
					});
				}
				{   
					numComboBox1 = new JComboBox();
					wmStuPsyComPanel.add(numComboBox1);
					numComboBox1.setBounds(224, 21, 42, 28);
					String [] weeknum = new String[]{"1","2","3","4","5","6",
							"7","8","9","10","11","12",
							"13","14","15","16","17","18"};
						String [] monthmnum = new String[]{"1","2","3","4"};
						if(this.weekormonComboBox.getSelectedItem().equals("周"))
						{
							numComboBox1Model = new DefaultComboBoxModel(
									weeknum);
						}
						else 
						{
							numComboBox1Model = new DefaultComboBoxModel(
									monthmnum);
						}
						numComboBox1.setModel(numComboBox1Model);
				}
				{
					contLabel1 = new JLabel();
					wmStuPsyComPanel.add(contLabel1);
					contLabel1.setText("\u7b2c");
					contLabel1.setBounds(210, 21, 35, 28);
				}
				{
					okButton = new JButton();
					wmStuPsyComPanel.add(okButton);
					okButton.setText("\u63d0\u4ea4");
					okButton.setBounds(182, 371, 63, 28);
					okButton.setEnabled(false);
					okButton.addActionListener(new ActionListener() {
						public void actionPerformed(ActionEvent evt) {
							okButtonActionPerformed(evt);
						}
					});
				}
				{
					ComboBoxModel termComboBoxModel = new DefaultComboBoxModel(
						new String[] { "上学期", "下学期" });
					termComboBox = new JComboBox();
					wmStuPsyComPanel.add(termComboBox);
					termComboBox.setModel(termComboBoxModel);
					termComboBox.setBounds(133, 21, 70, 28);
				}
			}
			{
				showTablePanel1 = new JPanel();
				AnchorLayout showTablePanel1Layout = new AnchorLayout();
				getContentPane().add(showTablePanel1);
				showTablePanel1.setLayout(showTablePanel1Layout);
				showTablePanel1.setBounds(0, 0, 581, 462);
				showTablePanel1.setBackground(new java.awt.Color(185,185,255));
				{
					mixCheckBox = new JCheckBox();
					showTablePanel1.add(mixCheckBox, new AnchorConstraint(182, 718, 243, 565, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
					mixCheckBox.setText("\u6a21\u7cca\u67e5\u8be2");
					mixCheckBox.setPreferredSize(new java.awt.Dimension(84, 28));
					mixCheckBox.setBackground(new java.awt.Color(185,185,255));
					mixCheckBox.setEnabled(false);
				}
				{
					commentScrollPane = new JScrollPane();
					showTablePanel1.add(commentScrollPane, new AnchorConstraint(288, 964, 925, 12, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
					commentScrollPane.setPreferredSize(new java.awt.Dimension(553, 294));
					{
						commentTableModel = new DefaultTableModel(
							new String[][] {},
							new String[] { "评论号","年度", "周/月", "学号", "姓名", "心理评论",
									"学习评论", "评论老师" });
						commentTable = new JTable();
						commentScrollPane.setViewportView(commentTable);
						commentTable.setModel(commentTableModel);
						commentTable.getTableHeader().setBounds(0, 0, 553, 49);
						//commentTable.setPreferredSize(new java.awt.Dimension(553, 84));
					}
				}
				{
					//利用循环为查询时候的学期数组赋值
					queryYearTerm[0] ="全部";
					for(int nowYear=date.getYear()+1890,i=1;nowYear<date.getYear()+1900;nowYear++)
					{
						int afterYear = nowYear+1;
						queryYearTerm[i]= nowYear+"~"+afterYear+"学年上学期";
						queryYearTerm[i+1]=nowYear+"~"+afterYear+"学年下学期";
						i = i+2;
					}
					//把下拉框的下拉选项设置为查询数组的值
					 wmStuPsyComComboBoxModel = new DefaultComboBoxModel(queryYearTerm);
					wmStuPsyComComboBox = new JComboBox();
					showTablePanel1.add(wmStuPsyComComboBox, new AnchorConstraint(46, 347, 107, 77, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
					wmStuPsyComComboBox.setModel(wmStuPsyComComboBoxModel);
					wmStuPsyComComboBox.setPreferredSize(new java.awt.Dimension(147, 28));
				}
				{
					ComboBoxModel wmComboBoxModel = new DefaultComboBoxModel(
						new String[] { "全部", "周", "月" });
					wmComboBox = new JComboBox();
					showTablePanel1.add(wmComboBox, new AnchorConstraint(46, 539, 107, 372, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
					wmComboBox.setModel(wmComboBoxModel);
					wmComboBox.setPreferredSize(new java.awt.Dimension(91, 28));
				}
				{
					ComboBoxModel spComboBoxModel = new DefaultComboBoxModel(
						new String[] { "全部", "心理", "学习" });
					spComboBox = new JComboBox();
					showTablePanel1.add(spComboBox, new AnchorConstraint(46, 782, 107, 590, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
					spComboBox.setModel(spComboBoxModel);
					spComboBox.setPreferredSize(new java.awt.Dimension(105, 28));
				}
				{
					commentLabel = new JLabel();
					showTablePanel1.add(commentLabel, new AnchorConstraint(46, 923, 107, 808, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
					commentLabel.setText("\u8bc4\u8bba");
					commentLabel.setPreferredSize(new java.awt.Dimension(63, 28));
				}
				{
					anLabel = new JLabel();
					showTablePanel1.add(anLabel, new AnchorConstraint(182, 167, 243, 65, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -