// Decompiled by DJ v2.9.9.61 Copyright 2000 Atanas Neshkov  Date: 24/12/2002 11:24:17
// Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   LoginBox.java

import java.applet.Applet;
import java.applet.AppletContext;
import java.awt.*;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.*;
import java.net.URL;

class LoginFrame extends Frame
    implements WindowListener
{

    public void windowDeactivated(WindowEvent windowevent)
    {
    }

    public void windowClosing(WindowEvent windowevent)
    {
        dispose();
    }

    LoginFrame(String s, LoginBox loginbox)
    {
        super(s);
        lb = loginbox;
        addWindowListener(this);
    }

    public void windowOpened(WindowEvent windowevent)
    {
    }

    public void windowClosed(WindowEvent windowevent)
    {
    }

    public void windowDeiconified(WindowEvent windowevent)
    {
    }

    public void windowActivated(WindowEvent windowevent)
    {
    }

    public boolean action(Event event, Object obj)
    {
        Button button = (Button)event.target;
        if(button.getLabel().equals("Cancel"))
        {
            dispose();
            lb.stop();
        } else
        if(button.getLabel().equals("Ok"))
        {
            String s = lb.t1.getText();
            String s1 = lb.t2.getText();
            try
            {
                java.io.InputStream inputstream = null;
                inputstream = (new URL(lb.getCodeBase(), "pass.txt")).openStream();
                BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(inputstream));
                String s2;
                while((s2 = bufferedreader.readLine()) != null) 
                {
                    int i = s2.indexOf(" ");
                    int j = s2.indexOf(" ", i + 1);
                    if(i != -1 && s2.substring(0, i).equals(s) & s2.substring(i + 1, j).equals(s1))
                    {
                        lb.url = s2.substring(j + 1);
                        URL url = lb.giveURL(lb.url);
                        dispose();
                        lb.getAppletContext().showDocument(url);
                        lb.stop();
                    }
                }
                lb.t1.setText("Wrong!");
                lb.t2.setText("Wrong!");
            }
            catch(Exception exception)
            {
                System.err.println(exception);
            }
        }
        return true;
    }

    public void windowIconified(WindowEvent windowevent)
    {
    }

    LoginBox lb;
}