Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.EventQueue;
- import javax.swing.JFrame;
- import javax.swing.JButton;
- import javax.swing.JToolBar;
- import javax.swing.JTextField;
- import javax.swing.JLabel;
- import javax.swing.JSeparator;
- import javax.swing.JTable;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- import java.util.Scanner;
- public class system {
- protected static final int Admin = 0;
- private JFrame frame;
- private JTextField Usernameinput;
- private JTextField Passwordinput;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- Scanner input = new Scanner(System.in);
- public void run() {
- try {
- system window = new system();
- window.frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the application.
- */
- public system() {
- initialize();
- }
- /**
- * Initialize the contents of the frame.
- */
- private void initialize() {
- frame = new JFrame();
- frame.setBounds(100, 100, 534, 365);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.getContentPane().setLayout(null);
- JButton btnLogin = new JButton("Login");
- btnLogin.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- String username;
- String password;
- System.out.println("Log in:");
- System.out.println("username: ");
- Scanner input = null;
- username = input.next();
- System.out.println("password: ");
- password = input.next();
- //users check = new users(username, password);
- if(Usernameinput.equals(Admin) && Passwordinput.equals(Admin))
- System.out.println("Welcome");;
- }
- });
- btnLogin.setBounds(29, 242, 89, 23);
- frame.getContentPane().add(btnLogin);
- JButton btnReset = new JButton("Reset");
- btnReset.setBounds(144, 242, 89, 23);
- frame.getContentPane().add(btnReset);
- JButton btnExit = new JButton("Exit");
- btnExit.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- System.exit(0);
- }
- });
- btnExit.setBounds(397, 282, 89, 23);
- frame.getContentPane().add(btnExit);
- Usernameinput = new JTextField();
- Usernameinput.setBounds(144, 74, 209, 20);
- frame.getContentPane().add(Usernameinput);
- Usernameinput.setColumns(10);
- Passwordinput = new JTextField();
- Passwordinput.setColumns(10);
- Passwordinput.setBounds(144, 106, 209, 20);
- frame.getContentPane().add(Passwordinput);
- JLabel lblUsername = new JLabel("Username:");
- lblUsername.setBounds(73, 77, 55, 14);
- frame.getContentPane().add(lblUsername);
- JLabel lblPassword = new JLabel("Password:");
- lblPassword.setBounds(73, 108, 55, 17);
- frame.getContentPane().add(lblPassword);
- JSeparator separator = new JSeparator();
- separator.setBounds(10, 211, 498, 2);
- frame.getContentPane().add(separator);
- JSeparator separator_1 = new JSeparator();
- separator_1.setBounds(10, 57, 498, 2);
- frame.getContentPane().add(separator_1);
- JLabel lblNewLabel = new JLabel("Welcome to The System v 0.1");
- lblNewLabel.setBounds(182, 5, 151, 41);
- frame.getContentPane().add(lblNewLabel);
- }
- }
Add Comment
Please, Sign In to add comment