Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.event.*;
- import javax.swing.*;
- import javax.swing.JOptionPane;
- public class Main extends JFrame implements ActionListener{
- JLabel unLabel, pwLabel;
- JTextField unTextField, pwTextField;
- JButton okButton, clearButton, exitButton;
- public Main()
- {
- setLayout(null);
- unLabel = new JLabel("Username:");
- pwLabel = new JLabel("Password:");
- unTextField = new JTextField("");
- pwTextField = new JTextField("");
- okButton = new JButton("OK");
- clearButton = new JButton("RESET");
- exitButton = new JButton("EXIT");
- unLabel.setBounds(50, 50, 100, 20);
- pwLabel.setBounds(50, 80, 100, 20);
- unTextField.setBounds(150, 50, 100, 20);
- pwTextField.setBounds(150, 80, 100, 20);
- okButton.setBounds(50, 150, 100, 20);
- clearButton.setBounds(150, 150, 100, 20);
- exitButton.setBounds(250, 150, 100, 20);
- add(unLabel);
- add(pwLabel);
- add(unTextField);
- add(pwTextField);
- add(okButton);
- add(clearButton);
- add(exitButton);
- okButton.addActionListener(this);
- clearButton.addActionListener(this);
- exitButton.addActionListener(this);
- }
- public void actionPerformed(ActionEvent event)
- {
- if (event.getSource()==clearButton)
- {
- unTextField.setText("");
- pwTextField.setText("");
- }
- else if (event.getSource()==exitButton)
- {
- System.exit(0);
- }
- else
- {
- if((unTextField.getText().equals("adminishi"))&&(pwTextField.getText().equals("123123")))
- {
- //JOptionPane.showMessageDialog(rootPane, "Congratulation!");
- ishi me = new ishi();
- me.setSize(500, 300);
- me.setVisible(true);
- {
- /* if((unTextField.getText().equals("201010403"))&&(pwTextField.getText().equals("Borbe")))
- JOptionPane.showMessageDialog(rootPane, "Congratulation!"); */
- }
- }
- }
- }
- public static void main(String[] args)
- {
- Main login = new Main();
- login.setSize(500, 300);
- login.setVisible(true);
- }
- }
Add Comment
Please, Sign In to add comment