2
* To change this template, choose Tools | Templates
3
* and open the template in the editor.
2
(C) 2009 Michael Chaten
3
This file is part of GoodGame.
5
GoodGame is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; version 3 of the License
9
GoodGame is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program. If not, see <http://www.gnu.org/licenses/>.
5
17
package net.sf.goodgame.client.gui;
19
import java.awt.BorderLayout;
7
20
import java.awt.CardLayout;
8
21
import java.awt.Component;
22
import java.awt.Dimension;
9
23
import java.awt.GridLayout;
10
24
import java.awt.event.ActionEvent;
11
25
import java.awt.event.ActionListener;
26
import javax.swing.Box;
12
27
import javax.swing.JButton;
13
28
import javax.swing.JLabel;
14
29
import javax.swing.JPanel;
36
51
public LoginPanel(GoodGameUI ui, InputOutput io) {
39
login = new TranslucentJButton("Login", 0.8f);
54
login = new TranslucentJButton("Login", 1f);
41
56
login.addActionListener(new ActionListener() {
48
register = new TranslucentJButton("Register", 0.8f);
63
register = new TranslucentJButton("Register", 1f);
49
64
register.addActionListener(new ActionListener() {
51
66
public void actionPerformed(ActionEvent e) {
56
71
JPanel choicePanel = new JPanel();
72
choicePanel.setPreferredSize(new Dimension(Integer.MAX_VALUE,Integer.MAX_VALUE));
57
73
choicePanel.setOpaque(false);
58
choicePanel.add(login);
59
choicePanel.add(register);
74
choicePanel.setLayout(new BorderLayout());
75
JPanel temp = new JPanel();
76
temp.setOpaque(false);
79
choicePanel.add(Box.createVerticalStrut(400),BorderLayout.NORTH);
80
choicePanel.add(temp,BorderLayout.CENTER);
61
82
JPanel loginPanel = getLoginPanel();
111
132
private JPanel getRegisterPanel() {
112
133
final JLabel usernameLabel = new JLabel("Username");
113
final JLabel password1Label = new JLabel("Password");
134
final JLabel password1Label = new JLabel("Password (6 or more characters, case sensitive)");
114
135
final JLabel password2Label = new JLabel("Confirm Password");
115
136
final JLabel emailLabel = new JLabel("Email Address");
116
137
final JTextField usernameField = new JTextField();