/** * Creates a new Register GUI * * @param regCont the register controllers */ public GUIRegister(RegisterController regCont) { this.setTitle("Enduro"); this.setVisible(true); this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); this.setResizable(true); this.setLayout(new GridLayout(3, 1)); int width = java.awt.Toolkit.getDefaultToolkit().getScreenSize().width / 2; int height = java.awt.Toolkit.getDefaultToolkit().getScreenSize().height / 2; this.setSize(width, height); this.setLocationRelativeTo(null); TimeArea timeArea = new TimeArea(); this.add(timeArea); resultField = new JTextArea(); resultField.setEditable(false); Font font1 = new Font("SansSerif", Font.BOLD, 60); Font font2 = new Font("SansSerif", Font.BOLD, 16); resultField.setFont(font2); panel = new JPanel(); panel.setLayout(new GridLayout(1, 2)); registerButton = new RegisterButton(this, regCont); registerButton.setPreferredSize(new Dimension(width / 2, height / 2)); registerField = new RegisterField(registerButton); registerField.setHorizontalAlignment(JTextField.CENTER); registerField.setFont(font1); this.add(panel); this.add(resultField); panel.add(registerField); panel.add(registerButton); this.pack(); }
/** * This method is called from within the constructor to initialize the form. WARNING: Do NOT * modify this code. The content of this method is always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { WelcomeLabel = new javax.swing.JLabel(); UsernameLoginLabel = new javax.swing.JLabel(); PasswordLoginLabel = new javax.swing.JLabel(); UsernameLogin = new javax.swing.JTextField(); SignInButton = new javax.swing.JButton(); RegisterButton = new javax.swing.JButton(); PasswordLogin = new javax.swing.JPasswordField(); SetSocket = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); WelcomeLabel.setFont(new java.awt.Font("Times New Roman", 0, 24)); // NOI18N WelcomeLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); WelcomeLabel.setText("Welcome!"); UsernameLoginLabel.setText("Username:"******"Password:"******"Sign in"); SignInButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { SignInButtonActionPerformed(evt); } }); RegisterButton.setText("Register"); RegisterButton.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { RegisterButtonActionPerformed(evt); } }); PasswordLogin.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { PasswordLoginActionPerformed(evt); } }); SetSocket.setText("Set Socket"); SetSocket.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { SetSocketActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addComponent(RegisterButton) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(SetSocket) .addContainerGap()) .addGroup( layout .createSequentialGroup() .addGap(54, 54, 54) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(UsernameLoginLabel) .addComponent(PasswordLoginLabel)) .addGap(18, 18, 18) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( PasswordLogin, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE) .addComponent( WelcomeLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE) .addComponent( UsernameLogin, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE)) .addContainerGap(111, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup( javax.swing.GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addContainerGap(160, Short.MAX_VALUE) .addComponent(SignInButton) .addGap(150, 150, 150))); layout.setVerticalGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addGap(55, 55, 55) .addComponent( WelcomeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent( UsernameLogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(UsernameLoginLabel)) .addGap(23, 23, 23) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(PasswordLoginLabel) .addComponent( PasswordLogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(31, 31, 31) .addComponent(SignInButton) .addPreferredGap( javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE) .addGroup( layout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(RegisterButton) .addComponent(SetSocket)) .addContainerGap())); pack(); } // </editor-fold>//GEN-END:initComponents