~mchaten/gg/main

« back to all changes in this revision

Viewing changes to main/client/src/net/sf/goodgame/client/gui/LoginPanel.java

  • Committer: mchaten
  • Date: 2009-04-22 07:06:42 UTC
  • Revision ID: mchaten@gmail.com-20090422070642-kiscs52mfrikfbn5
Tags: 0.2b1
Multiple Fixes
Can't cancel out of a new game setup 
Can't have a new game with no name, and all spaces are trimmed out of new names for games
GPL Warnings for admin classes, GUIDispatcher and LoginPanel

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * To change this template, choose Tools | Templates
3
 
 * and open the template in the editor.
4
 
 */
 
2
    (C) 2009 Michael Chaten
 
3
        This file is part of GoodGame.
 
4
 
 
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
 
8
 
 
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.
 
13
 
 
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/>.
 
16
*/
5
17
package net.sf.goodgame.client.gui;
6
18
 
 
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) {
37
52
        this.io = io;
38
53
        this.ui = ui;
39
 
        login = new TranslucentJButton("Login", 0.8f);
 
54
        login = new TranslucentJButton("Login", 1f);
40
55
 
41
56
        login.addActionListener(new ActionListener() {
42
57
 
45
60
            }
46
61
        });
47
62
 
48
 
        register = new TranslucentJButton("Register", 0.8f);
 
63
        register = new TranslucentJButton("Register", 1f);
49
64
        register.addActionListener(new ActionListener() {
50
65
 
51
66
            public void actionPerformed(ActionEvent e) {
54
69
        });
55
70
 
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);
 
77
        temp.add(login);
 
78
        temp.add(register);
 
79
        choicePanel.add(Box.createVerticalStrut(400),BorderLayout.NORTH);
 
80
        choicePanel.add(temp,BorderLayout.CENTER);
60
81
 
61
82
        JPanel loginPanel = getLoginPanel();
62
83
 
64
85
 
65
86
 
66
87
        root = new JPanel();
67
 
        root.setVisible(false);
 
88
        root.setOpaque(false);
68
89
        root.setLayout(layout = new CardLayout());
69
90
 
70
91
        root.add(loginPanel, LOGIN_LOOK);
110
131
 
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();