示例#1
0
  @SuppressWarnings("unchecked")
  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  private void initComponents() {

    jLabel3 = new javax.swing.JLabel();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    user_name = new javax.swing.JTextField();
    login = new javax.swing.JButton();
    Password = new javax.swing.JPasswordField();

    jLabel3.setIcon(
        new javax.swing.ImageIcon(getClass().getResource("/image/iMAGE2.jpg"))); // NOI18N

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setPreferredSize(new java.awt.Dimension(560, 250));
    setResizable(false);
    getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

    jLabel1.setFont(new java.awt.Font("Calibri", 1, 24)); // NOI18N
    jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    jLabel1.setText("Username");
    getContentPane()
        .add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 40, 140, 40));

    jLabel2.setFont(new java.awt.Font("Calibri", 1, 24)); // NOI18N
    jLabel2.setText("Password");
    getContentPane()
        .add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 100, 140, 40));

    user_name.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
    user_name.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            user_nameActionPerformed(evt);
          }
        });
    getContentPane()
        .add(user_name, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 50, 150, 30));

    login.setFont(new java.awt.Font("Calibri", 1, 18)); // NOI18N
    login.setText("Login");
    login.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            loginActionPerformed(evt);
          }
        });
    getContentPane()
        .add(login, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 150, 100, 30));

    Password.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
    Password.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            PasswordActionPerformed(evt);
          }
        });
    getContentPane()
        .add(Password, new org.netbeans.lib.awtextra.AbsoluteConstraints(270, 100, 150, 30));

    pack();
  } // </editor-fold>//GEN-END:initComponents
示例#2
0
 public LoginJFrame() {
   initComponents();
   user_name.addActionListener(this);
   Password.addActionListener(this);
 }