Advertisement
Guest User

Login Panel

a guest
Oct 12th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.74 KB | None | 0 0
  1. import java.awt.EventQueue;
  2.  
  3. import javax.swing.JFrame;
  4. import javax.swing.JPanel;
  5. import javax.swing.border.EmptyBorder;
  6. import javax.swing.JLabel;
  7.  
  8. import java.awt.Font;
  9. import java.awt.event.ActionListener;
  10.  
  11. import javax.swing.JTextField;
  12. import javax.swing.JPasswordField;
  13. import javax.swing.JComboBox;
  14. import javax.swing.JButton;
  15. import javax.swing.DefaultComboBoxModel;
  16. import java.awt.event.ActionEvent;
  17.  
  18.  
  19.  
  20. public class Login extends JFrame {
  21.  
  22.     private JPanel contentPane;
  23.     private JTextField User;
  24.     private JPasswordField Pass;
  25.  
  26.     /**
  27.      * Launch the application.
  28.      */
  29.     public static void main(String[] args) {
  30.         EventQueue.invokeLater(new Runnable() {
  31.             public void run() {
  32.                 try {
  33.                     Login frame = new Login();
  34.                     frame.setVisible(true);
  35.                 } catch (Exception e) {
  36.                     e.printStackTrace();
  37.                 }
  38.             }
  39.         });
  40.     }
  41.  
  42.     /**
  43.      * Create the frame.
  44.      */
  45.     public Login() {
  46.         setResizable(false);
  47.         setType(Type.UTILITY);
  48.         setTitle("MMG-Aklan Pharmacy Sales & Inventory System");
  49.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  50.         setBounds(100, 100, 425, 199);
  51.         contentPane = new JPanel();
  52.         contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  53.         setContentPane(contentPane);
  54.         contentPane.setLayout(null);
  55.        
  56.         JLabel Title = new JLabel("Login");
  57.         Title.setBounds(175, 11, 116, 25);
  58.         Title.setFont(new Font("Tahoma", Font.BOLD, 20));
  59.         contentPane.add(Title);
  60.        
  61.         JLabel UserL = new JLabel("Username:");
  62.         UserL.setFont(new Font("Tahoma", Font.PLAIN, 16));
  63.         UserL.setBounds(10, 48, 83, 14);
  64.         contentPane.add(UserL);
  65.  
  66.         JLabel PassL = new JLabel("Password:");
  67.         PassL.setFont(new Font("Tahoma", Font.PLAIN, 16));
  68.         PassL.setBounds(10, 95, 83, 14);
  69.         contentPane.add(PassL);    
  70.        
  71.         User = new JTextField();
  72.         User.setColumns(10);
  73.         User.setBounds(103, 47, 109, 20);
  74.         contentPane.add(User);
  75.        
  76.  
  77.        
  78.         Pass = new JPasswordField();
  79.         Pass.setBounds(103, 94, 109, 20);
  80.         contentPane.add(Pass);
  81.        
  82.         JComboBox Down = new JComboBox();
  83.         Down.setModel(new DefaultComboBoxModel(new String[] {"Cashier", "Manager", "Admin"}));
  84.         Down.setMaximumRowCount(3);
  85.         Down.setFont(new Font("Tahoma", Font.BOLD, 15));
  86.         Down.setBounds(236, 45, 161, 20);
  87.         contentPane.add(Down);
  88.        
  89.         JButton Login = new JButton("Login");
  90.         Login.addActionListener(new ActionListener() {
  91.             public void actionPerformed(ActionEvent arg0) {
  92.                
  93.             }
  94.         });
  95.         Login.setFont(new Font("Tahoma", Font.BOLD, 11));
  96.         Login.setBounds(236, 92, 76, 25);
  97.         contentPane.add(Login);
  98.  
  99.        
  100.        
  101.        
  102.         /**
  103.        
  104.        
  105.         **/
  106.         JButton Cancel = new JButton("Cancel");
  107.         Cancel.setFont(new Font("Tahoma", Font.BOLD, 11));
  108.         Cancel.setBounds(320, 93, 77, 23);
  109.         contentPane.add(Cancel);
  110.         Cancel.addActionListener(new CloseListener());
  111.     }
  112.  
  113.        
  114.    
  115.    
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement