?? jsdljf.java
字號:
package gui;import com.cloudgarden.layout.AnchorLayout;import javax.swing.JOptionPane;import javax.swing.JTextField;import javax.swing.JLabel;import com.cloudgarden.layout.AnchorConstraint;import javax.swing.JButton;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 jsdlJF extends javax.swing.JFrame { private JButton jButton1; private JLabel jLabel2; private JButton jButton2; private JTextField jTextField2; private JTextField jTextField1; private JLabel jLabel1; static jsdlJF inst; /** * Auto-generated main method to display this JFrame */ public static void main(String[] args) { inst = new jsdlJF(); inst.setVisible(true); } public jsdlJF() { super(); initGUI(); } public void setInit(jsdlJF j) { this.inst=j; 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); { jButton2 = new JButton(); this.getContentPane().add( jButton2, new AnchorConstraint( 671, 723, 783, 570, 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) { JsJFrame j=new JsJFrame(); j.setVisible(true); j.setInst(j); inst.setVisible(false); } }); } { jTextField2 = new JTextField(); this.getContentPane().add( jTextField2, new AnchorConstraint( 389, 781, 501, 434, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jTextField2.setPreferredSize(new java.awt.Dimension(136, 30)); } { jLabel2 = new JLabel(); this.getContentPane().add( jLabel2, new AnchorConstraint( 381, 381, 494, 49, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jLabel2.setText("\u8bf7\u8f93\u5165\u7ba1\u7406\u5458\u5bc6\u7801\uff1a"); jLabel2.setPreferredSize(new java.awt.Dimension(130, 30)); } { jTextField1 = new JTextField(); this.getContentPane().add( jTextField1, new AnchorConstraint( 167, 779, 280, 434, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jTextField1.setPreferredSize(new java.awt.Dimension(135, 30)); } { jLabel1 = new JLabel(); this.getContentPane().add( jLabel1, new AnchorConstraint( 171, 366, 283, 52, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL)); jLabel1.setText("\u8bf7\u8f93\u5165\u7ba1\u7406\u5458\u540d\u79f0\uff1a"); jLabel1.setPreferredSize(new java.awt.Dimension(123, 30)); } { jButton1 = new JButton(); this.getContentPane().add( jButton1, new AnchorConstraint( 667, 299, 780, 146, 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 username=jTextField1.getText(); String password=jTextField2.getText();// if(username.equals(""))// JOptionPane.showMessageDialog(null, "用戶名不能為空!");// if(password.equals(""))// JOptionPane.showMessageDialog(null, "密碼不能為空!"); if(username.equals("admin")) { if (password.equals("admin")) { KCTJ kctj=new KCTJ(); kctj.setVisible(true); kctj.setInst(kctj); inst.setVisible(false); } else JOptionPane.showMessageDialog(null, "密碼不正確,請重新輸入!"); } else JOptionPane.showMessageDialog(null, "用戶名不正確,請重新輸入!"); } }); } pack(); setSize(400, 300); } 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 + -