📄 xsxk.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.model.Student;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 XSXK extends javax.swing.JFrame { private JLabel jLabel1; private JLabel jLabel2; private JButton jButton2; private JButton jButton1; private JTextField jTextField2; private JLabel jLabel3; private JTextField jTextField1; static XSXK inst; Student stu=new Student(); /** * Auto-generated main method to display this JFrame */ public static void main(String[] args) { inst = new XSXK(); inst.setVisible(true); } public XSXK() { super(); initGUI(); } public void setInst(XSXK inst){ this.inst=inst; inst.setLocation((1024-400)/2, (768-300)/2); } public void setStu(Student stu) { this.stu=stu; } private void initGUI() { try { AnchorLayout thisLayout = new AnchorLayout(); this.getContentPane().setLayout(thisLayout); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); { jButton2 = new JButton(); this.getContentPane().add( jButton2, new AnchorConstraint( 659, 662, 761, 541, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jButton2.setText("\u8fd4\u56de"); jButton2.setPreferredSize(new java.awt.Dimension(60, 30)); jButton2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { DLCG m=new DLCG(stu); m.setVisible(true); m.setInst(m); inst.setVisible(false); } }); } { jButton1 = new JButton(); this.getContentPane().add( jButton1, new AnchorConstraint( 659, 263, 761, 142, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jButton1.setText("\u786e\u5b9a"); jButton1.setPreferredSize(new java.awt.Dimension(60, 30)); jButton1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String kh=jTextField1.getText(); String jsxm=jTextField2.getText(); Course c=new Course(); c.setCno(kh); c.setCteacher(jsxm); BussinessServices bs=new BussinessServices(); boolean f=bs.chooseCou(stu, c); if (f) { JOptionPane.showMessageDialog(null, "恭喜您选课成功!"); DLCG m=new DLCG(stu); m.setVisible(true); m.setInst(m); inst.setVisible(false); } else { JOptionPane.showMessageDialog(null, "选课失败,请重新选课!"); DLCG m=new DLCG(stu); m.setVisible(true); m.setInst(m); inst.setVisible(false); } } }); } { jTextField2 = new JTextField(); this.getContentPane().add( jTextField2, new AnchorConstraint( 419, 710, 522, 476, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jTextField2.setPreferredSize(new java.awt.Dimension(116, 30)); } { jLabel3 = new JLabel(); this.getContentPane().add( jLabel3, new AnchorConstraint( 433, 456, 535, 79, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jLabel3.setPreferredSize(new java.awt.Dimension(187, 30)); jLabel3.setText("\u8bf7\u8f93\u5165\u60a8\u9009\u62e9\u8bfe\u7a0b\u7684\u6388\u8bfe\u8001\u5e08\uff1a"); } { jTextField1 = new JTextField(); this.getContentPane().add( jTextField1, new AnchorConstraint( 248, 706, 351, 476, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jTextField1.setPreferredSize(new java.awt.Dimension(114, 30)); } { jLabel2 = new JLabel(); this.getContentPane().add( jLabel2, new AnchorConstraint( 251, 426, 354, 71, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jLabel2.setText("\u8bf7\u8f93\u5165\u60a8\u9009\u62e9\u8bfe\u7a0b\u7684\u8bfe\u7a0b\u53f7\uff1a"); jLabel2.setPreferredSize(new java.awt.Dimension(176, 30)); } { jLabel1 = new JLabel(); this.getContentPane().add( jLabel1, new AnchorConstraint( 83, 553, 207, 420, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jLabel1.setText("\u9009\u8bfe"); jLabel1.setPreferredSize(new java.awt.Dimension(66, 36)); jLabel1.setFont(new java.awt.Font("Dialog",1,22)); } pack(); this.setSize(504, 326); } 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 + -