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

📄 studyaddframe.java

📁 包含了学生管理系统的一些基本操作以及相关窗口页面实现。
💻 JAVA
字号:
package com.hb.studentmanager.ui;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;

import javax.swing.WindowConstants;

import sun.management.counter.Counter;

import com.hb.studentmanager.action.StudyAction;


/**
* 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 StudyAddFrame extends javax.swing.JDialog {
	public JLabel stuidjLabel;
	public JLabel xinlijLabel;
	public JLabel weekjLabel;
	public JLabel monthjLabel;
	public JComboBox weekjComboBox;
	private JLabel jLabel5;
	private JLabel jLabel4;
	private JLabel jLabel3;
	private JLabel jLabel2;
	private JLabel jLabel1;
	public JComboBox stuidjComboBox;
	public JComboBox xueqjComboBox;
	public JLabel xueqjLabel;
	public JButton submjButton;
	public JComboBox monthjComboBox;
	public JComboBox studyjComboBox;
	public JComboBox xinlijComboBox;
	public JLabel studyjLabel;
	public DefaultComboBoxModel stuidjComboBoxModel;
    StudyMainFrame smf=new StudyMainFrame();
    StudyAction sa=new StudyAction();
	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
	}
	
	public StudyAddFrame(StudyMainFrame smf) {
		super();
		initGUI(smf);
		int width=Toolkit.getDefaultToolkit().getScreenSize().width;
		int height=Toolkit.getDefaultToolkit().getScreenSize().height;
		this.setLocation((width-450)/2, (height-470)/2);
		this.setResizable(false);
		this.setTitle("\u6dfb\u52a0\u5b66\u751f\u5b66\u4e60");
	}
	
	private void initGUI(final StudyMainFrame smf) {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			{
				stuidjLabel = new JLabel();
				getContentPane().add(stuidjLabel);
				stuidjLabel.setText("\u5b66\u53f7\uff1a");
				stuidjLabel.setBounds(77, 28, 63, 28);
			}
			{
				xinlijLabel = new JLabel();
				getContentPane().add(xinlijLabel);
				xinlijLabel.setText("\u5fc3\u7406\u60c5\u51b5\uff1a");
				xinlijLabel.setBounds(77, 84, 77, 28);
			}
			{
				studyjLabel = new JLabel();
				getContentPane().add(studyjLabel);
				studyjLabel.setText("\u5b66\u4e60\u60c5\u51b5\uff1a");
				studyjLabel.setBounds(77, 154, 77, 28);
			}
			{
				weekjLabel = new JLabel();
				getContentPane().add(weekjLabel);
				weekjLabel.setText("\u65f6\u95f4\u5468\uff1a");
				weekjLabel.setBounds(77, 224, 84, 28);
			}
			{
				monthjLabel = new JLabel();
				getContentPane().add(monthjLabel);
				monthjLabel.setText("\u6708\u65f6\u95f4\uff1a");
				monthjLabel.setBounds(77, 287, 77, 28);
			}
			{
				ComboBoxModel xinlijComboBoxModel = new DefaultComboBoxModel(
					new String[] {null, "不理想", "正常","良好","优秀" });
				xinlijComboBox = new JComboBox();
				getContentPane().add(xinlijComboBox);
				xinlijComboBox.setModel(xinlijComboBoxModel);
				xinlijComboBox.setBounds(182, 84, 119, 28);
			}
			{
				ComboBoxModel studyjComboBoxModel = new DefaultComboBoxModel(
					new String[] {null,"不理想", "正常","良好","优秀" });
				studyjComboBox = new JComboBox();
				getContentPane().add(studyjComboBox);
				studyjComboBox.setModel(studyjComboBoxModel);
				studyjComboBox.setBounds(182, 154, 119, 28);
			}
			{
				ComboBoxModel weekjComboBoxModel = new DefaultComboBoxModel(
						new String[]{"","第一周","第二周","第三周","第四周","第五周"
								,"第六周","第七周","第八周","第九周","第十周"
								,"第十一周","第十二周","第十三周","第十四周","第十五周","第十六周"
								,"第十七周","第十八周"});
				weekjComboBox = new JComboBox();
				getContentPane().add(weekjComboBox);
				weekjComboBox.setModel(weekjComboBoxModel);
				weekjComboBox.setBounds(182, 224, 119, 28);
			}
			{
				ComboBoxModel monthjComboBoxModel = new DefaultComboBoxModel(
						new String[]{"","第一月","第二月","第三月","第四月","第五月"});
				monthjComboBox = new JComboBox();
				getContentPane().add(monthjComboBox);
				monthjComboBox.setModel(monthjComboBoxModel);
				monthjComboBox.setBounds(182, 287, 119, 28);
			}
			{
				submjButton = new JButton();
				getContentPane().add(submjButton);
				submjButton.setText("\u63d0\u4ea4");
				submjButton.setBounds(329, 406, 77, 28);
				submjButton.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						submjButtonActionPerformed(evt,smf);
					}
				});
				smf.gettable(smf.s1,smf.s2,smf.s3,smf.s4,smf.s5,smf.s6,smf.s7);
			}
			{
				xueqjLabel = new JLabel();
				getContentPane().add(xueqjLabel);
				xueqjLabel.setText("\u5b66\u671f\uff1a");
				xueqjLabel.setBounds(77, 357, 63, 28);
			}
			{
				ComboBoxModel xueqjComboBoxModel = new DefaultComboBoxModel(
						new String[] { "", "第一学期" , "第二学期", "第三学期", "第四学期"
								, "第五学期", "第六学期", "第七学期", "第八学期"});
				xueqjComboBox = new JComboBox();
				getContentPane().add(xueqjComboBox);
				xueqjComboBox.setModel(xueqjComboBoxModel);
				xueqjComboBox.setBounds(182, 357, 119, 28);
			}
			{
				stuidjComboBoxModel = new DefaultComboBoxModel();
				sa.getStudentId(stuidjComboBoxModel);//得到学号				stuidjComboBox = new JComboBox();
				getContentPane().add(stuidjComboBox);
				stuidjComboBox.setModel(stuidjComboBoxModel);
				stuidjComboBox.setBounds(182, 28, 119, 28);
				stuidjComboBox.insertItemAt("", 0);
			}
			{
				jLabel1 = new JLabel();
				getContentPane().add(jLabel1);
				jLabel1.setText("(*\u6b64\u9879\u5fc5\u987b\u9009\u62e9)");
				jLabel1.setBounds(301, 28, 105, 28);
			}
			{
				jLabel2 = new JLabel();
				getContentPane().add(jLabel2);
				jLabel2.setText("(*\u6b64\u9879\u5fc5\u987b\u9009\u62e9)");
				jLabel2.setBounds(301, 224, 105, 28);
			}
			{
				jLabel3 = new JLabel();
				getContentPane().add(jLabel3);
				jLabel3.setText("(*\u6b64\u9879\u5fc5\u987b\u9009\u62e9)");
				jLabel3.setBounds(301, 287, 98, 28);
			}
			{
				jLabel4 = new JLabel();
				getContentPane().add(jLabel4);
				jLabel4.setText("(*\u6b64\u9879\u5fc5\u987b\u9009\u62e9)");
				jLabel4.setBounds(301, 357, 105, 28);
			}
			{
				jLabel5 = new JLabel();
				getContentPane().add(jLabel5);
				jLabel5.setText("(*\u7b2c\u4e00\u6708\u4e3a\u4e00\u5230\u56db\u5468\uff0c\u4f9d\u6b21\u7c7b\u63a8\uff0c\u7b2c\u4e94\u6708\u4e3a\u5341\u4e03\u5230\u5341\u516b\u5468)");
				jLabel5.setBounds(77, 259, 364, 28);
			}
			pack();
			setSize(450, 470);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	private void submjButtonActionPerformed(ActionEvent evt,StudyMainFrame smf) {
		String s2=weekjComboBox.getSelectedItem().toString();
		String s3=monthjComboBox.getSelectedItem().toString();
		String s4=xueqjComboBox.getSelectedItem().toString();
		
		if(stuidjComboBox.getSelectedItem()==null||s2.equals("")||s3.equals("")||s4.equals("")){
			
			JOptionPane.showMessageDialog(this, "学号,周时间,月时间和学期不能为空");
		}
		else{
		
		
		if(s3.equals("第一月")){
			if(s2.equals("第一周")||s2.equals("第二周")||s2.equals("第三周")||s2.equals("第四周")){
				showtable();
			}
			else{
				JOptionPane.showMessageDialog(this,"第一月只能是第一周到第四周" );
			}
		}
		 if(s3.equals("第二月")){
			if(s2.equals("第八周")||s2.equals("第五周")||s2.equals("第六周")||s2.equals("第七周")){
				showtable();
			}
			else{
				JOptionPane.showMessageDialog(this,"第二月只能是第五周到第八周" );
			}
		}
		 if(s3.equals("第三月")){
			if(s2.equals("第九周")||s2.equals("第十周")||s2.equals("第十一周")||s2.equals("第十二周")){
				showtable();
			}
			else{
				JOptionPane.showMessageDialog(this,"第三月只能是第九周到第十二周" );
			}
		}
		 if(s3.equals("第四月")){
			if(s2.equals("第十三周")||s2.equals("第十四周")||s2.equals("第十五周")||s2.equals("第十六周")){
				showtable();
			}
			else{
				JOptionPane.showMessageDialog(this,"第四月只能是第十三周到第十六周" );
			}
		}
		if(s3.equals("第五月")){
			if(s2.equals("第十七周")||s2.equals("第十八周")){
				showtable();
			}
			else{
				JOptionPane.showMessageDialog(this,"第五月只能是第十七周到第十八周" );
			}
		}
		
		}
}
	
		public void showtable(){
		try {
			JOptionPane.showConfirmDialog(this, "是否确定添加","警告!",JOptionPane.OK_OPTION);
			boolean b;
			b=sa.AddStudy(this);
			if(b==true){
				this.setVisible(false);
				smf.s1="";smf.s2="";smf.s3="";smf.s4="";smf.s5="";smf.s6="";smf.s7="";
				smf.gettable(smf.s1,smf.s2,smf.s3,smf.s4,smf.s5,smf.s6,smf.s7);
			}
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
}

⌨️ 快捷键说明

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