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

📄 kctj.java

📁 在线的java web 做的 学生选课系统。自己做的。大家可以一起讨论。
💻 JAVA
字号:
package gui;import com.cloudgarden.layout.AnchorLayout;import javax.swing.JButton;import javax.swing.JOptionPane;import javax.swing.JTextField;import com.cloudgarden.layout.AnchorConstraint;import edu.sist200.model.Course;import edu.sist200.services.BussinessServices;import javax.swing.JLabel;import java.awt.event.ActionListener;import java.awt.event.ActionEvent;import javax.swing.WindowConstants;/*** This code was 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 KCTJ extends javax.swing.JFrame {	private JLabel jLabel1;	private JLabel jLabel2;	private JLabel jLabel4;	private JButton jButton3;	private JButton jButton2;	private JButton jButton1;	private JTextField dqxs;	private JLabel jLabel7;	private JTextField xsrs;	private JLabel jLabel6;	private JTextField skdd;	private JLabel jLabel5;	private JTextField skjs;	private JTextField kcm;	private JLabel jLabel3;	private JTextField jTextField1;	static KCTJ inst;	/**	* Auto-generated main method to display this JFrame	*/	public static void main(String[] args) {		 inst= new KCTJ();		inst.setVisible(true);	}		public KCTJ() {		super();		initGUI();	}	public void setInst(KCTJ inst){		this.inst=inst;		inst.setLocation((1024-400)/2, (768-300)/2);	}	private void initGUI() {		try {			AnchorLayout thisLayout = new AnchorLayout();			this.getContentPane().setLayout(thisLayout);			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);			{				jButton3 = new JButton();				this.getContentPane().add(					jButton3,					new AnchorConstraint(						565,						853,						649,						716,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				jButton3.setText("\u8fd4\u56de");				jButton3.setPreferredSize(new java.awt.Dimension(73, 30));				jButton3.addActionListener(new ActionListener() {					public void actionPerformed(ActionEvent evt) {						jsdlJF j=new jsdlJF();						j.setVisible(true);						j.setInit(j);						inst.setVisible(false);					}				});			}			{				jButton2 = new JButton();				this.getContentPane().add(					jButton2,					new AnchorConstraint(						400,						857,						484,						717,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				jButton2.setText("\u6e05\u7a7a");				jButton2.setPreferredSize(new java.awt.Dimension(74, 30));				jButton2.addActionListener(new ActionListener() {					public void actionPerformed(ActionEvent evt) {						dqxs.setText("");						xsrs.setText("");						skdd.setText("");						skjs.setText("");						kcm.setText("");						jTextField1.setText("");					}				});			}			{				jButton1 = new JButton();				this.getContentPane().add(					jButton1,					new AnchorConstraint(						244,						859,						328,						710,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				jButton1.setText("\u6dfb\u52a0");				jButton1.setPreferredSize(new java.awt.Dimension(79, 30));				jButton1.addActionListener(new ActionListener() {					public void actionPerformed(ActionEvent evt) {						Course c=new Course();						BussinessServices bs=new BussinessServices();						c.setCno(jTextField1.getText());						c.setCname(kcm.getText());						c.setCaddress(skdd.getText());						c.setCteacher(skjs.getText());						c.setNowstu(dqxs.getText());						c.setTotalstu(xsrs.getText());						bs.addCourse(c);						JOptionPane.showMessageDialog(null, "课程添加成功!");						dqxs.setText("");						xsrs.setText("");						skdd.setText("");						skjs.setText("");						kcm.setText("");						jTextField1.setText("");																	}				});			}			{				dqxs = new JTextField();				this.getContentPane().add(					dqxs,					new AnchorConstraint(						780,						533,						864,						293,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				dqxs.setPreferredSize(new java.awt.Dimension(127, 30));			}			{				jLabel7 = new JLabel();				this.getContentPane().add(					jLabel7,					new AnchorConstraint(						775,						253,						858,						31,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				jLabel7.setText("\u8bf7\u8f93\u5165\u5f53\u524d\u5b66\u751f\u6570\uff1a");				jLabel7.setPreferredSize(new java.awt.Dimension(118, 30));			}			{				xsrs = new JTextField();				this.getContentPane().add(					xsrs,					new AnchorConstraint(						649,						551,						730,						353,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				xsrs.setPreferredSize(new java.awt.Dimension(105, 29));			}			{				jLabel6 = new JLabel();				this.getContentPane().add(					jLabel6,					new AnchorConstraint(						649,						350,						733,						19,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				jLabel6.setText("\u8bf7\u8f93\u5165\u5141\u8bb8\u4e0a\u8bfe\u5b66\u751f\u7684\u4eba\u6570\uff1a");				jLabel6.setPreferredSize(new java.awt.Dimension(175, 30));			}			{				skdd = new JTextField();				this.getContentPane().add(					skdd,					new AnchorConstraint(						526,						553,						599,						253,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				skdd.setPreferredSize(new java.awt.Dimension(159, 26));			}			{				jLabel5 = new JLabel();				this.getContentPane().add(					jLabel5,					new AnchorConstraint(						540,						238,						624,						33,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				jLabel5.setText("\u8bf7\u8f93\u5165\u6388\u8bfe\u5730\u70b9\uff1a");				jLabel5.setPreferredSize(new java.awt.Dimension(109, 30));			}			{				skjs = new JTextField();				this.getContentPane().add(					skjs,					new AnchorConstraint(						412,						572,						490,						255,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				skjs.setPreferredSize(new java.awt.Dimension(168, 28));			}			{				jLabel4 = new JLabel();				this.getContentPane().add(					jLabel4,					new AnchorConstraint(						409,						238,						493,						36,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				jLabel4.setText("\u8bf7\u8f93\u5165\u6388\u8bfe\u6559\u5e08\uff1a");				jLabel4.setPreferredSize(new java.awt.Dimension(107, 30));			}			{				kcm = new JTextField();				this.getContentPane().add(					kcm,					new AnchorConstraint(						294,						578,						372,						255,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				kcm.setPreferredSize(new java.awt.Dimension(171, 28));			}			{				jLabel3 = new JLabel();				this.getContentPane().add(					jLabel3,					new AnchorConstraint(						289,						236,						375,						51,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				jLabel3.setText("\u8bf7\u8f93\u5165\u8bfe\u7a0b\u540d\uff1a");				jLabel3.setPreferredSize(new java.awt.Dimension(98, 31));			}			{				jTextField1 = new JTextField();				this.getContentPane().add(					jTextField1,					new AnchorConstraint(						157,						591,						241,						265,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				jTextField1.setPreferredSize(new java.awt.Dimension(173, 30));			}			{				jLabel2 = new JLabel();				this.getContentPane().add(					jLabel2,					new AnchorConstraint(						149,						234,						244,						55,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				jLabel2.setText("\u8bf7\u8f93\u5165\u8bfe\u7a0b\u53f7\uff1a");				jLabel2.setPreferredSize(new java.awt.Dimension(95, 34));			}			{				jLabel1 = new JLabel();				this.getContentPane().add(					jLabel1,					new AnchorConstraint(						31,						654,						144,						317,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL,						AnchorConstraint.ANCHOR_REL));				jLabel1.setText("\u6dfb\u52a0\u8bfe\u7a0b\u4fe1\u606f");				jLabel1.setPreferredSize(new java.awt.Dimension(132, 30));				jLabel1.setFont(new java.awt.Font("Dialog",1,20));			}			pack();			this.setSize(538, 392);		} catch (Exception e) {			e.printStackTrace();		}	}		/**	* Auto-generated method for setting the popup menu for a component	*/	private void setComponentPopupMenu(final java.awt.Component parent, final javax.swing.JPopupMenu menu) {parent.addMouseListener(new java.awt.event.MouseAdapter() {public void mousePressed(java.awt.event.MouseEvent e) {if(e.isPopupTrigger())menu.show(parent, e.getX(), e.getY());}public void mouseReleased(java.awt.event.MouseEvent e) {if(e.isPopupTrigger())menu.show(parent, e.getX(), e.getY());}});	}}

⌨️ 快捷键说明

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