
import java.awt.*;
import PicturePanel;
import java.applet.*;

public class LoginPanel extends PicturePanel 
{

   Image logo;
   Button button2;	
   TextField userid, passwd;
   Label label1,label2;
   boolean allow;
   Main parent;


   LoginPanel(Image img, Main app)
   {
      super(img);
      logo = img; 
      parent = app;
      allow = false;

      label1 = new Label("User Name:");
      label2 = new Label("Password :");
      userid = new TextField();
      passwd = new TextField();
      button2 = new Button("Login");
      bottom.add(userid);
      bottom.add(label1);
      bottom.add(label2);
      bottom.add(passwd);
      bottom.add(button2);
      repaint();
   }

   public void paint(Graphics g)
   {
      Graphics p = top.getGraphics();
      p.drawImage(logo, 160, 100, this);
      button2.reshape(300, 120, 80, 30);
      label1.reshape(160, 50, 100, 30);
      label2.reshape(160, 80, 100, 30);
      userid.reshape(270, 50, 150, 30);
      passwd.reshape(270, 80, 150, 30);
   }
 
   void handleButton(String str)
   {
      if(str.equals("Login"))
      {
         if(userid.getText().equals("group10"))
            if(passwd.getText().equals("group10"))
               parent.LoadSplashScreen(); 
      }
      if(str.equals("New User"))
      {
      }
   }

   public boolean action(Event evt, Object arg)
   {
      if(evt.target instanceof Button)
      {
         handleButton((String)arg);
         return true;
      }
         return true;
   }


}
