package codeu.chat.client.simplegui.newaccountframe;

import java.awt.Button;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class NewAccount extends JFrame {

    // constructor
    public NewAccount () {

        JPanel panel = new JPanel(new GridBagLayout());
        GridBagConstraints gbConstraints = new GridBagConstraints();

        // create user label
        JLabel userNameLabel = new JLabel("Please create a user name");
        gbConstraints.fill = GridBagConstraints.HORIZONTAL;
        gbConstraints.gridx = 0;
        gbConstraints.gridy = 0;
        panel.add(userNameLabel, gbConstraints);

        // username textfield
        JTextField usernameTextField = new JTextField("", 20);
        gbConstraints.fill = GridBagConstraints.HORIZONTAL;
        gbConstraints.gridx = 0;
        gbConstraints.gridy = 1;
        panel.add(usernameTextField, gbConstraints);

        // create password label
        JLabel userPasswordLabel = new JLabel("Please create a password");
        gbConstraints.fill = GridBagConstraints.HORIZONTAL;
        gbConstraints.gridx = 0;
        gbConstraints.gridy = 2;
        panel.add(userPasswordLabel, gbConstraints);

        // password textfield
        JTextField userpasswordTextField = new JTextField("", 20);
        gbConstraints.fill = GridBagConstraints.HORIZONTAL;
        gbConstraints.gridx = 0;
        gbConstraints.gridy = 3;
        panel.add(userpasswordTextField, gbConstraints);

        // create account button
        JButton createAccountButton = new JButton("Create");
        gbConstraints.fill = GridBagConstraints.HORIZONTAL;
        gbConstraints.gridx = 0;
        gbConstraints.gridy = 3;
        panel.add(createAccountButton, gbConstraints);

        // cancel button
        JButton cancelButton = new JButton("Cancel");
        gbConstraints.fill = GridBagConstraints.HORIZONTAL;
        gbConstraints.gridx = 0;
        gbConstraints.gridy = 4;
        panel.add(cancelButton, gbConstraints);

        this.setSize(400, 400);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setTitle("Create an Account");
        panel.add(cancelButton);
        panel.add(userNameLabel);
        panel.add(userPasswordLabel);
        panel.add(usernameTextField);
        panel.add(userpasswordTextField);
        //this.add(panel);
        
        this.pack();
        this.setVisible(true);
    }   // end of NewAccount()



}   // end of class NewAccount

@@ -365,24 +365,83 @@
 count () %7B%0A%0A
+        // groundwork%0A        JFrame frame = new JFrame();%0A
         JPan
@@ -484,16 +484,61 @@
 out());%0A
+        panel.setAlignmentX(LEFT_ALIGNMENT);%0A
         
@@ -617,20 +617,23 @@
  create 
-user
+welcome
  label%0A 
@@ -646,22 +646,21 @@
  JLabel 
-userNa
+welco
 meLabel 
@@ -677,33 +677,65 @@
 el(%22
+Welcome to ChatU!%5Cn
 Please 
-create
+select
  a user
- 
 name
+ and password.
 %22);%0A
@@ -760,44 +760,200 @@
 nts.
-fill = GridBagConstraints.HORIZONTAL
+gridx = 0;%0A        gbConstraints.gridy = 0;%0A        panel.add(welcomeLabel, gbConstraints);%0A%0A        // create user label%0A        JLabel userNameLabel = new JLabel(%22Please create a user name%22)
 ;%0A  
@@ -1005,33 +1005,33 @@
 traints.gridy = 
-0
+1
 ;%0A        panel.
@@ -1115,25 +1115,25 @@
 xtField user
-n
+N
 ameTextField
@@ -1163,68 +1163,8 @@
 0);%0A
-        gbConstraints.fill = GridBagConstraints.HORIZONTAL;%0A
     
@@ -1214,33 +1214,33 @@
 traints.gridy = 
-1
+2
 ;%0A        panel.
@@ -1239,33 +1239,33 @@
   panel.add(user
-n
+N
 ameTextField, gb
@@ -1391,68 +1391,8 @@
 %22);%0A
-        gbConstraints.fill = GridBagConstraints.HORIZONTAL;%0A
     
@@ -1442,33 +1442,33 @@
 traints.gridy = 
-2
+3
 ;%0A        panel.
@@ -1608,68 +1608,8 @@
 0);%0A
-        gbConstraints.fill = GridBagConstraints.HORIZONTAL;%0A
     
@@ -1659,33 +1659,33 @@
 traints.gridy = 
-3
+4
 ;%0A        panel.
@@ -1826,68 +1826,8 @@
 %22);%0A
-        gbConstraints.fill = GridBagConstraints.HORIZONTAL;%0A
     
@@ -1877,33 +1877,33 @@
 traints.gridy = 
-3
+5
 ;%0A        panel.
@@ -2027,68 +2027,8 @@
 %22);%0A
-        gbConstraints.fill = GridBagConstraints.HORIZONTAL;%0A
     
@@ -2045,33 +2045,33 @@
 traints.gridx = 
-0
+1
 ;%0A        gbCons
@@ -2078,33 +2078,33 @@
 traints.gridy = 
-4
+5
 ;%0A        panel.
@@ -2150,44 +2150,13 @@
     
-this.setSize(400, 400);%0A        this
+frame
 .set
@@ -2204,28 +2204,29 @@
 E);%0A        
-this
+frame
 .setTitle(%22C
@@ -2257,199 +2257,30 @@
     
-panel.add(cancelButton);%0A        panel.add(userNameLabel);%0A        panel.add(userPasswordLabel);%0A        panel.add(usernameTextField);%0A        panel.add(userpasswordTextField);%0A        //this
+frame.getContentPane()
 .add
@@ -2296,29 +2296,21 @@
         
-%0A        this
+frame
 .pack();
@@ -2322,12 +2322,13 @@
     
-this
+frame
 .set
@@ -2347,18 +2347,16 @@
 );%0A    %7D
-  
  // end 

Create user page