📄 xszc.java
字号:
package gui;import com.cloudgarden.layout.AnchorLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.JButton;import javax.swing.JOptionPane;import javax.swing.JTextField;import com.cloudgarden.layout.AnchorConstraint;import edu.sist200.model.Student;import edu.sist200.services.BussinessServices;import javax.swing.JLabel;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 XSZC extends javax.swing.JFrame { private JLabel jLabel1; private JLabel jLabel2; private JLabel jLabel4; private JTextField jTextField4; private JLabel jLabel6; private JTextField jTextField3; private JButton jButton2; private JButton jButton1; private JTextField jTextField2; private JLabel jLabel5; private JTextField jTextField1; private JLabel xsxb; private JTextField xsxm; private JLabel jLabel3; private JTextField xsxh; static XSZC inst; /** * Auto-generated main method to display this JFrame */ public static void main(String[] args) { inst= new XSZC(); inst.setVisible(true); } public XSZC() { super(); initGUI(); } public void setInst(XSZC 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); { jTextField4 = new JTextField(); this.getContentPane().add( jTextField4, new AnchorConstraint( 412, 592, 483, 335, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jTextField4.setPreferredSize(new java.awt.Dimension(120, 24)); } { jLabel6 = new JLabel(); this.getContentPane().add( jLabel6, new AnchorConstraint( 394, 307, 483, 69, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jLabel6.setText("\u8bf7\u8f93\u5165\u5b66\u751f\u5bc6\u7801:"); jLabel6.setPreferredSize(new java.awt.Dimension(111, 30)); } { jTextField3 = new JTextField(); this.getContentPane().add( jTextField3, new AnchorConstraint( 610, 585, 684, 317, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jTextField3.setPreferredSize(new java.awt.Dimension(125, 25)); } { jButton2 = new JButton(); this.getContentPane().add( jButton2, new AnchorConstraint( 847, 729, 936, 600, 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) { XsJFrame m=new XsJFrame(); m.setVisible(true); m.setInst(m); inst.setVisible(false); } }); } { jButton1 = new JButton(); this.getContentPane().add( jButton1, new AnchorConstraint( 844, 341, 933, 213, 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 xh=xsxh.getText(); String xm=xsxm.getText(); String xsxb=jTextField1.getText(); String xszy=jTextField3.getText(); String xsyx=jTextField2.getText(); String xsmm=jTextField4.getText(); Student s=new Student(); s.setSno(xh); s.setName(xm); s.setSex(xsxb); s.setMajor(xszy); s.setEmail(xsyx); s.setPassword(xsmm); BussinessServices bs=new BussinessServices(); bs.addStu(s); JOptionPane.showMessageDialog(null, "注册成功!"); XsJFrame m=new XsJFrame(); m.setVisible(true); m.setInst(m); inst.setVisible(false); } }); } { jTextField2 = new JTextField(); this.getContentPane().add( jTextField2, new AnchorConstraint( 717, 729, 791, 309, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jTextField2.setPreferredSize(new java.awt.Dimension(196, 25)); } { jLabel5 = new JLabel(); this.getContentPane().add( jLabel5, new AnchorConstraint( 717, 302, 806, 50, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jLabel5.setText("\u8bf7\u8f93\u5165\u5b66\u751f\u7684Email:"); jLabel5.setPreferredSize(new java.awt.Dimension(118, 30)); } { jLabel4 = new JLabel(); this.getContentPane().add( jLabel4, new AnchorConstraint( 607, 298, 696, 50, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jLabel4.setText("\u8bf7\u8f93\u5165\u5b66\u751f\u7684\u4e13\u4e1a:"); jLabel4.setPreferredSize(new java.awt.Dimension(116, 30)); } { jTextField1 = new JTextField(); this.getContentPane().add( jTextField1, new AnchorConstraint( 504, 461, 584, 332, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jTextField1.setPreferredSize(new java.awt.Dimension(60, 27)); } { xsxb = new JLabel(); this.getContentPane().add( xsxb, new AnchorConstraint( 498, 279, 587, 46, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); xsxb.setText("\u8bf7\u8f93\u5165\u5b66\u751f\u7684\u6027\u522b:"); xsxb.setPreferredSize(new java.awt.Dimension(109, 30)); } { xsxm = new JTextField(); this.getContentPane().add( xsxm, new AnchorConstraint( 303, 602, 383, 330, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); xsxm.setPreferredSize(new java.awt.Dimension(127, 27)); } { jLabel3 = new JLabel(); this.getContentPane().add( jLabel3, new AnchorConstraint( 303, 302, 392, 56, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jLabel3.setText("\u8bf7\u8f93\u5165\u5b66\u751f\u7684\u59d3\u540d:"); jLabel3.setPreferredSize(new java.awt.Dimension(115, 30)); } { xsxh = new JTextField(); this.getContentPane().add( xsxh, new AnchorConstraint( 187, 604, 264, 330, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); xsxh.setPreferredSize(new java.awt.Dimension(128, 26)); } { jLabel2 = new JLabel(); this.getContentPane().add( jLabel2, new AnchorConstraint( 173, 298, 261, 52, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jLabel2.setText("\u8bf7\u8f93\u5165\u5b66\u751f\u7684\u5b66\u53f7:"); jLabel2.setPreferredSize(new java.awt.Dimension(115, 30)); } { jLabel1 = new JLabel(); this.getContentPane().add( jLabel1, new AnchorConstraint( 48, 656, 137, 345, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jLabel1.setText("\u6ce8\u518c\u5b66\u751f\u4fe1\u606f"); jLabel1.setPreferredSize(new java.awt.Dimension(145, 30)); jLabel1.setFont(new java.awt.Font("Dialog",1,18)); } pack(); this.setSize(475, 372); } 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 + -