|
@ -6,29 +6,54 @@ import java.awt.event.ActionListener; |
|
|
import javax.swing.JButton; |
|
|
import javax.swing.JButton; |
|
|
import javax.swing.JFrame; |
|
|
import javax.swing.JFrame; |
|
|
import javax.swing.JLabel; |
|
|
import javax.swing.JLabel; |
|
|
|
|
|
import javax.swing.JOptionPane; |
|
|
import javax.swing.JPanel; |
|
|
import javax.swing.JPanel; |
|
|
import javax.swing.JTextField; |
|
|
import javax.swing.JTextField; |
|
|
|
|
|
|
|
|
public class LoginWIndow implements ActionListener { |
|
|
public class LoginWIndow implements ActionListener { |
|
|
JPanel panel = new JPanel(); |
|
|
JPanel panel = new JPanel(); |
|
|
JFrame frame = new JFrame(); |
|
|
JFrame frame = new JFrame(); |
|
|
|
|
|
|
|
|
JLabel labelLogin = new JLabel("login"); |
|
|
JLabel labelLogin = new JLabel("login"); |
|
|
JTextField textLogin = new JTextField(null, 20); |
|
|
JTextField textLogin = new JTextField(null, 20); |
|
|
|
|
|
String textFieldValueLogin = ""; |
|
|
|
|
|
|
|
|
JLabel labelPasswort = new JLabel("passwort"); |
|
|
JLabel labelPasswort = new JLabel("passwort"); |
|
|
JTextField textPasswort = new JTextField(null, 20); |
|
|
JTextField textPasswort = new JTextField(null, 20); |
|
|
JButton button = new JButton(); |
|
|
|
|
|
|
|
|
String textFieldValuePasswort = ""; |
|
|
|
|
|
|
|
|
|
|
|
JButton button = new JButton("Confirm"); |
|
|
|
|
|
|
|
|
public LoginWIndow() { |
|
|
public LoginWIndow() { |
|
|
this.frame.setSize(250, 300); |
|
|
this.frame.setSize(250, 300); |
|
|
this.frame.setContentPane(panel); |
|
|
this.frame.setContentPane(panel); |
|
|
this.button.addActionListener(this); |
|
|
this.button.addActionListener(this); |
|
|
|
|
|
|
|
|
|
|
|
this.panel.add(this.labelLogin); |
|
|
|
|
|
this.panel.add(this.textLogin); |
|
|
|
|
|
this.panel.add(this.labelPasswort); |
|
|
|
|
|
this.panel.add(this.textPasswort); |
|
|
|
|
|
this.panel.add(this.button); |
|
|
this.frame.setVisible(true); |
|
|
this.frame.setVisible(true); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void actionPerformed(ActionEvent e) { |
|
|
public void actionPerformed(ActionEvent e) { |
|
|
// TODO Auto-generated method stub |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
textFieldValueLogin = textLogin.getText(); |
|
|
|
|
|
textFieldValuePasswort = textPasswort.getText(); |
|
|
|
|
|
|
|
|
|
|
|
if(textFieldValueLogin.equals("user") && textFieldValuePasswort.equals("testpasswort")) { |
|
|
|
|
|
System.out.println("Login erfolgreich"); |
|
|
|
|
|
JOptionPane.showMessageDialog(null, "Erfolgreich angemeldet!", "Coolio", JOptionPane.OK_OPTION); |
|
|
|
|
|
//JOptionPane.showInternalMessageDialog(frame, "Erfolgreich angemeldet!", "Coolio", JOptionPane.INFORMATION_MESSAGE); |
|
|
|
|
|
this.frame.setVisible(false); |
|
|
|
|
|
this.frame.dispose(); |
|
|
|
|
|
} else { |
|
|
|
|
|
System.out.println("Login nicht erfolgreich"); |
|
|
|
|
|
JOptionPane.showMessageDialog(null, "Falscher Nutzername oder Passwort.", "Achtung", JOptionPane.ERROR_MESSAGE); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |