Package voxo.client.newviews

Source Code of voxo.client.newviews.LoginWindow

package voxo.client.newviews;

import javax.swing.JDialog;
import javax.swing.JFrame;
import java.awt.GridBagLayout;
import javax.swing.JTextField;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import javax.swing.JButton;

import voxo.client.newlisteners.DialogLoginListener;

public class LoginWindow extends JDialog {
  private JTextField  txtUsername;
  private JTextField  txtPassword;

  public LoginWindow() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] { 50, 0, 50, 0 };
    gridBagLayout.rowHeights = new int[] { 50, 0, 0, 0, 50, 0 };
    gridBagLayout.columnWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE };
    gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
    getContentPane().setLayout(gridBagLayout);

    txtUsername = new JTextField();
    txtUsername.setText("Username");
    GridBagConstraints gbc_txtUsername = new GridBagConstraints();
    gbc_txtUsername.insets = new Insets(0, 0, 5, 5);
    gbc_txtUsername.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtUsername.gridx = 1;
    gbc_txtUsername.gridy = 1;
    getContentPane().add(txtUsername, gbc_txtUsername);
    txtUsername.setColumns(10);

    txtPassword = new JTextField();
    txtPassword.setText("Password");
    GridBagConstraints gbc_txtPassword = new GridBagConstraints();
    gbc_txtPassword.insets = new Insets(0, 0, 5, 5);
    gbc_txtPassword.fill = GridBagConstraints.HORIZONTAL;
    gbc_txtPassword.gridx = 1;
    gbc_txtPassword.gridy = 2;
    getContentPane().add(txtPassword, gbc_txtPassword);
    txtPassword.setColumns(10);

    JButton btnLogin = new JButton("Login");
    btnLogin.addActionListener(new DialogLoginListener(txtUsername, txtPassword));
    GridBagConstraints gbc_btnLogin = new GridBagConstraints();
    gbc_btnLogin.fill = GridBagConstraints.BOTH;
    gbc_btnLogin.insets = new Insets(0, 0, 5, 5);
    gbc_btnLogin.gridx = 1;
    gbc_btnLogin.gridy = 3;
    getContentPane().add(btnLogin, gbc_btnLogin);

    this.setModal(true);
    this.setVisible(true);
  }
}
TOP

Related Classes of voxo.client.newviews.LoginWindow

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.