summaryrefslogtreecommitdiffstats
path: root/Dozentenmodul/src/GUI/LoginWindow.java
blob: e272ac2bf9cf8e69c603cc8c0091b879ab09b9ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package GUI;

import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.Image;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;

import auth.Ldap;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JPasswordField;

public class LoginWindow extends JFrame {

	private JPanel contentPane;
	private JTextField username;
	private JPasswordField pass;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					LoginWindow frame = new LoginWindow();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public LoginWindow() {
		try {
			//System.out.println(UIManager.getSystemLookAndFeelClassName().toString());
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (ClassNotFoundException | InstantiationException
				| IllegalAccessException | UnsupportedLookAndFeelException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		setTitle("Dozentenmodul Login");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel imgLabel = new JLabel();
	
		imgLabel.setBounds(10, 11, 350, 64);
		
		ImageIcon icon = new ImageIcon("img/Logo_bwLehrpool.png","Logo");
		Image scaled=icon.getImage().getScaledInstance(350, 64, 0);
		imgLabel.setIcon(new ImageIcon(scaled));
		contentPane.add(imgLabel);
		
		JLabel LabelUser = new JLabel("bwIDM-Benutzername:");
		LabelUser.setBounds(10, 86, 134, 20);
		contentPane.add(LabelUser);
		
		username = new JTextField();
		username.setBounds(154, 86, 125, 20);
		contentPane.add(username);
		username.setColumns(10);
		
		JLabel LabelPass = new JLabel("bwIDM-Passwort:");
		LabelPass.setBounds(10, 117, 134, 20);
		contentPane.add(LabelPass);
		
		JButton BtnLogin = new JButton("Login");
		BtnLogin.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				Ldap check=new Ldap();
				check.LdapAuth(username.getText(),  new String(pass.getPassword()));
			}
		});
		BtnLogin.setBounds(10, 179, 134, 23);
		contentPane.add(BtnLogin);
		
		pass = new JPasswordField();
		pass.setBounds(154, 117, 125, 20);
		contentPane.add(pass);
	}
}