Advertisement
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 java.awt.BorderLayout;
- import javax.swing.JPanel;
- import java.awt.event.ActionListener;
- import java.awt.event.ActionEvent;
- import javax.swing.JLabel;
- import java.awt.Color;
- import javax.swing.JTextField;
- import javax.swing.JTextPane;
- import javax.swing.JLayeredPane;
- public class Main {
- private JFrame frame;
- private JTextField textField;
- private JTextField textField_1;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- Main window = new Main();
- window.frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the application.
- */
- public Main() {
- initialize();
- }
- /**
- * Initialize the contents of the frame.
- */
- private void initialize() {
- frame = new JFrame();
- frame.getContentPane().setForeground(Color.GREEN);
- frame.setBounds(100, 100, 612, 389);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.getContentPane().setLayout(null);
- JLabel lblUserName = new JLabel("User name");
- lblUserName.setBackground(Color.YELLOW);
- lblUserName.setBounds(158, 70, 67, 25);
- frame.getContentPane().add(lblUserName);
- JLabel lblPassword = new JLabel("Password");
- lblPassword.setBounds(158, 146, 53, 14);
- frame.getContentPane().add(lblPassword);
- textField = new JTextField();
- textField.setBounds(235, 143, 118, 20);
- frame.getContentPane().add(textField);
- textField.setColumns(10);
- textField_1 = new JTextField();
- textField_1.setColumns(10);
- textField_1.setBounds(235, 72, 118, 20);
- frame.getContentPane().add(textField_1);
- JButton btnLogin = new JButton("Login");
- btnLogin.setBounds(151, 228, 256, 61);
- frame.getContentPane().add(btnLogin);
- btnLogin.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e)
- {
- if(textField.equals("Admin"))
- {
- if(textField.equals("Admin"))
- {
- JLabel lblLoginSuccessPlease = new JLabel("LOGIN SUCCESS! Please wait while the other functions are loaded");
- lblLoginSuccessPlease.setBounds(124, 204, 344, 14);
- frame.getContentPane().add(lblLoginSuccessPlease);
- }
- }
- }
- });
- JLabel lblWelcomeToMy = new JLabel("Welcome to my amazing program!");
- lblWelcomeToMy.setBounds(174, 11, 242, 14);
- frame.getContentPane().add(lblWelcomeToMy);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement