private JAutoPanel window_login() {
		JAutoPanel frame = new JAutoPanel(this.desktop);

		JLabel eMafiaText = new JLabel("eMafia");
		JLabel usernameText = new JLabel("Username:");
		JTextField usernameField = new JTextField(15);
		usernameField.setName("username");
		JLabel passwordText = new JLabel("Password:");
		JPasswordField passwordField = new JPasswordField(15);
		passwordField.setName("password");
		JButton loginBut = new JButton("Login");
		Action loginAction = new AbstractAction("Login") {
			private static final long serialVersionUID = 1L;

			@SuppressWarnings("deprecation")
			public void actionPerformed(ActionEvent e) {
				String username = null;
				Component[] theList = ((Component) e.getSource()).getParent()
						.getComponents();
				for (Component comp : theList) {
					if (comp instanceof JTextField
							&& comp.getName().equals("username")) {
						((JTextField) comp).setEditable(false);
						username = ((JTextField) comp).getText();
					}
					if (comp instanceof JPasswordField
							&& comp.getName().equals("password")) {
						((JPasswordField) comp).setEditable(false);
						Framework.Telnet.var1 = ((JPasswordField) comp)
								.getText();
					}
					if (comp instanceof JButton) {
						if (((JButton) comp).getText().equals("Login")) {// can't
																			// use
																			// getName
																			// without
																			// errors..
							((JButton) comp).setEnabled(false);
						}
					}
				}
				Framework.Telnet.write(username);
			}
		};

		passwordField.setAction(loginAction);
		loginBut.setAction(loginAction);
		JButton registerBut = new JButton("Register");
		registerBut.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent evt) {
				Framework.Telnet.write("new");
			}
		});
		// registerBut.setEnabled(false);//Disabled until there is a
		// registartion
		JPanel loginFieldsPanel = new JPanel();
		GroupLayout loginFieldsLayout = new GroupLayout(loginFieldsPanel);
		loginFieldsPanel.setLayout(loginFieldsLayout);
		loginFieldsLayout.setAutoCreateGaps(true);
		loginFieldsLayout.setAutoCreateContainerGaps(true);

		loginFieldsLayout.setHorizontalGroup(loginFieldsLayout
				.createSequentialGroup()
				.addComponent(eMafiaText)
				.addGroup(
						loginFieldsLayout
								.createParallelGroup(
										GroupLayout.Alignment.LEADING)
								.addComponent(usernameText)
								.addComponent(passwordText)
								.addComponent(loginBut))
				.addGroup(
						loginFieldsLayout
								.createParallelGroup(
										GroupLayout.Alignment.LEADING)
								.addComponent(usernameField)
								.addComponent(passwordField)
								.addComponent(registerBut)));
		loginFieldsLayout.setVerticalGroup(loginFieldsLayout
				.createSequentialGroup()
				.addComponent(eMafiaText)
				.addGroup(
						loginFieldsLayout
								.createParallelGroup(
										GroupLayout.Alignment.BASELINE)
								.addComponent(usernameText)
								.addComponent(usernameField))
				.addGroup(
						loginFieldsLayout
								.createParallelGroup(
										GroupLayout.Alignment.BASELINE)
								.addComponent(passwordText)
								.addComponent(passwordField))
				.addGroup(
						loginFieldsLayout
								.createParallelGroup(
										GroupLayout.Alignment.BASELINE)
								.addComponent(loginBut)
								.addComponent(registerBut)));
		frame.add(loginFieldsPanel);
		frame.setSize(frame.getPreferredSize());
		frame.setAutoCenter();

		return frame;
	}