Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private JTextField paf;
- /**
- * Launch the application.
- */
- public static void main(String[] args) {
- EventQueue.invokeLater(new Runnable() {
- public void run() {
- try {
- GG frame = new GG();
- frame.setVisible(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- /**
- * Create the frame.
- */
- public GG() {
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setBounds(100, 100, 650, 500);
- contentPane = new JPanel();
- contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
- contentPane.setLayout(new BorderLayout(0, 0));
- setContentPane(contentPane);
- JPanel panel = new JPanel();
- contentPane.add(panel, BorderLayout.CENTER);
- panel.setLayout(null);
- JPanel panel_1 = new JPanel();
- panel_1.setBackground(SystemColor.textHighlight);
- panel_1.setBounds(0, 0, 624, 67);
- panel.add(panel_1);
- panel_1.setLayout(null);
- JLabel lblNewLabel = new JLabel("Login");
- lblNewLabel.setForeground(SystemColor.text);
- lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 30));
- lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
- lblNewLabel.setBounds(183, 5, 250, 51);
- panel_1.add(lblNewLabel);
- usf = new JTextField();
- usf.setFont(new Font("Tahoma", Font.PLAIN, 13));
- usf.setBounds(225, 150, 173, 29);
- panel.add(usf);
- usf.setColumns(10);
- paf = new JTextField();
- paf.setFont(new Font("Tahoma", Font.PLAIN, 13));
- paf.setColumns(10);
- paf.setBounds(225, 190, 173, 29);
- panel.add(paf);
- JLabel lblNewLabel_1 = new JLabel("Username:");
- lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 15));
- lblNewLabel_1.setBounds(126, 150, 89, 29);
- panel.add(lblNewLabel_1);
- JLabel lblPassword = new JLabel("Password:");
- lblPassword.setFont(new Font("Tahoma", Font.PLAIN, 15));
- lblPassword.setBounds(126, 190, 89, 29);
- panel.add(lblPassword);
- JButton Login = new JButton("Login");
- Login.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- for(int counter = 0;counter<G.username.length;counter++) {
- if(G.username[counter].equals(usf.getText())&&G.password[counter].equals(paf.getText())) {
- System.out.println("good");
- }
- }
- }
- });
- Login.setBounds(380, 280, 89, 23);
- panel.add(Login);
- JButton Registr = new JButton("Register");
- Registr.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- R r = new R();
- r.setVisible(true);
- }
- });
- Registr.setBounds(265, 280, 89, 23);
- panel.add(Registr);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement