package GUIAnwendungen.Meine_GUI_Chat;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;

public class View extends JFrame {
	
	private JLabel title = new JLabel("Log in: ");
	
	private JLabel userName = new JLabel("Name: ");
	private JTextField nameEingabe  = new JTextField();
	private JLabel password = new JLabel("Password: ");
	private JPasswordField passwordEingabe  = new JPasswordField();
	private JButton logIn = new JButton("Log in");
	//(int x, int y, int width, int height) 
	
	public View() {
		this.setTitle("Log in");
		this.setVisible(true);
		this.setSize(900, 650);
		this.setLayout(null);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		
		title.setBounds(10,20,120,20);
		userName.setBounds(10,50,100,20);
		nameEingabe.setBounds(140,50,140,20);
		
		password.setBounds(10,80,100,20);
		passwordEingabe.setBounds(140,80,140,20);
		logIn.setBounds(10,110,100,20);
		
		
		this.add(title);
		this.add(userName);
		this.add(nameEingabe);
		this.add(password);
		this.add(passwordEingabe);
		this.add(logIn);
		
	}
	
	public void zeigeUserInfos() {
        JOptionPane.showMessageDialog(null, "Deine Log in war erfolgreich", "Log in Erfolgreich", JOptionPane.INFORMATION_MESSAGE);
	}

	public String getNameEingabe() {
		return nameEingabe.getText();
	}


	public String getPasswordEingabe() {
        return new String(passwordEingabe.getPassword());
	}

	public JButton getLogIn() {
		return logIn;
	}
	
	public void schließeLoginFenster() {
	        this.dispose();  // Schließt das aktuelle Fenster
	 }
}
