*/
Check out and contribute to CodePedia, the wiki for developers.
*/

View java\java\bin\manoveg\client\CFrontEndp.java

networking authentication program 1.0

Submitted By: manoveg
Rating: (Not rated) (Rate It)


package client;
//import server.*;
import java.awt.*;
import java.util.*;
import java.sql.*;
import java.io.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;




public class CFrontEndp extends JFrame implements ActionListener
{
 public static final int WIDTH=300;
 public static final int HEIGHT=300;
 private JTextField Username;
 private JPasswordField Password;
 private JPasswordField NPassword;

 private JLabel User;
 private JLabel Passw;
 private JLabel NPassw;

 public String acommand1="";
 public String cuser="";
 public String cpassword="";
 public String npassword="";


 public CFrontEndp()
 {
  setTitle("Client:Change Password");
  setSize(WIDTH,HEIGHT);
  Container contentPane=getContentPane();

  Username= new JTextField("",10);
  Username.setMaximumSize(Username.getPreferredSize());
  Box hbox1=Box.createHorizontalBox();

  User=new JLabel("USERNAME");
  hbox1.add(User);
  hbox1.add(Box.createHorizontalStrut(10));
  hbox1.add(Username);

  Password= new JPasswordField("",10);
  Passw=new JLabel("OLD PASSWORD");
  Password.setMaximumSize(Password.getPreferredSize());
  Password.setEchoChar('*');

  NPassword= new JPasswordField("",10);
  NPassw=new JLabel("NEW PASSWORD");
  NPassword.setMaximumSize(Password.getPreferredSize());
  NPassword.setEchoChar('*');




  Box hbox2=Box.createHorizontalBox();
  hbox2.add(Passw);
  hbox2.add(Box.createHorizontalStrut(10));
  hbox2.add(Password);

  Box hbox3=Box.createHorizontalBox();
  hbox3.add(NPassw);
  hbox3.add(Box.createHorizontalStrut(10));
  hbox3.add(NPassword);


  Box hbox4=Box.createHorizontalBox();
  JButton Okbutton=new JButton("OK");
  JButton Back = new JButton("BACK");
  hbox4.add(Okbutton);
  hbox4.add(Box.createGlue());
  hbox4.add(Back);
  Okbutton.addActionListener(this);
  Back.addActionListener(this);

  Box vbox=Box.createVerticalBox();
  vbox.add(hbox1);
  vbox.add(hbox2);
  vbox.add(hbox3);

  vbox.add(Box.createGlue());
  vbox.add(hbox4);

  contentPane.add(vbox,BorderLayout.CENTER);

  }



  public void actionPerformed(ActionEvent ae)
  {

   acommand1=ae.getActionCommand();

   if(acommand1.equals("OK"))
   {

   //SFrontEnd SFront = new SFrontEnd();
   String user=Username.getText();
   String pwd=new String(Password.getPassword());
   String NPassword1=new String(NPassword.getPassword());   
   SecondConn c4 = new SecondConn();
   c4.receive(user,pwd,NPassword1);
//    this.dispose();   
   }

     
   else
   
    if(acommand1.equals("BACK"))
    {
          this.dispose();
    }



 }
}


class CDialogBox11 extends Dialog implements ActionListener
{
 String msg="";
 CDialogBox11(Frame parent , String title, String msg1)
 {
  super(parent, title , true);
  msg=msg1;
  setLayout(new FlowLayout(FlowLayout.LEFT));
  setSize(300,300);
  Button Ok = new Button("OK");
  add(Ok);
  Ok.addActionListener(this);
 }

 public void actionPerformed(ActionEvent ae1)
 {
  dispose();
 
  }

 public void paint(Graphics g)
 {
  g.drawString(msg,10,170);
  }
}

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.