这个JAVA是做什么呢,谁帮我看看呢 (100分)

  • 主题发起人 主题发起人 goddy
  • 开始时间 开始时间
G

goddy

Unregistered / Unconfirmed
GUEST, unregistred user!
///////////////////////////////////////////////////////////
// DeJaved by mDeJava v1.0. Copyright 1999 MoleSoftware. //
// Todo
wnload last version of this software: //
// http://molesoftware.hypermatr.net //
// e-mail:molesoftware@mail.ru //
///////////////////////////////////////////////////////////
import java.applet.Applet;
import java.awt.*;
import java.io.*;
import java.net.*;
import java.util.Date;
import java.util.StringTokenizer;
import netscape.javascript.JSObject;
public class LoginApplet extends Applet
implements Runnable
{
Button toInternetButton = null;
Button quitButton = null;
Button ConfirmButton = null;
Button logout1Button = null;
Button staticsButton = null;
Button logoutButton = null;
Button faultBackButton = null;
Button loginhelpButton = null;
Checkbox slientCheckbox = null;
Checkbox cookieCheckbox = null;
private LabeledTextField login = null;
private LabeledTextField password = null;
private LabeledTextField silentTime = null;
private LabeledLeftTextField stayedTime = null;
private LabeledLeftTextField loginTime = null;
private LabeledLeftTextField NameLeftTextField = null;
private boolean isRunning = false;
private String StrLastOnlineTime = null;
private String errorMsg = null;
public String loginnamecookie = null;
Color buttoncolor = null;
Color TextBackcolor = null;
Color TextForecolor = null;
Color TopLabelBackColor = null;
Color TopLabelForeColor = null;
Font TopLabelFont = null;
Font TextLabelFont = null;
Font linemessageFont = null;
Color LineColor = null;
Label message = null;
Panel p = null;
Panel exitPanel = null;
private Thread queryDisplayer = null;
PopFrame staticsFrame = null;
Label dataLabel1 = null;
Label dataLabel2 = null;
Label dataLabel3 = null;
Label dataLabel4 = null;
private String user = null;
private String pw = null;
private String userID = null;
private Socket sock = null;
private InetAddress server = null;
private int port = 0;
BufferedReader in = null;
BufferedWriter out = null;
JSObject win = null;
static final String e_REASON_LOGIN_SAME_IP_DIFFENT_USER = " /u5176/u4ED6/u7528/u6237/u5DF2/u7ECF/u767B/u5F55!";
static final String e_REASON_LOGIN_NAME_PASSWORD_ERROR = " /u7528/u6237/u540D/u3001/u5BC6/u7801/u9519/u8BEF !";
static final String e_REASON_LOGIN_NO_MONEY = "/u5269/u4F59/u65F6/u957F/u4E3A0/uFF0C/u8BF7/u7EED/u8D39!";
static final String e_REASON_LOGIN_SERVER_BUSY = " /u767B/u5F55/u670D/u52A1/u5668/u5FD9 !";
static final String e_REASON_LOGIN_SOCKET_ERROR = " /u901A/u4FE1/u5931/u8D25,/u8BF7/u7A0D/u540E/u64CD/u4F5C !";
static final String e_REASON_STAT_SOCKET_ERROR = " /u7528/u6237/u4E0B/u7EBF !";
static final String e_REASON_STAT_NO_SUCH_USER = " /u7528/u6237/u4E0B/u7EBF !";
static final String e_REASON_LOGIN_PASSWORD_TOOLONG = " /u5BC6/u7801/u9519/u8BEF/uFF01 ";
static final String e_REASON_LOGIN_USERNAME_TOOLONG = " /u7528/u6237/u540D/u9519/u8BEF/uFF01 ";
String answer = null;
public LoginApplet()
{
stayedTime = null;
loginTime = null;
NameLeftTextField = null;
isRunning = false;
StrLastOnlineTime = "0";
errorMsg = "";
buttoncolor = new Color(239, 239, 239);
TextBackcolor = new Color(239, 239, 239);
TextForecolor = Color.black;
TopLabelBackColor = new Color(255, 102, 0);
TopLabelForeColor = Color.white;
TopLabelFont = new Font("/u5B8B/u4F53_GB2312", 1, 16);
TextLabelFont = new Font("/u5B8B/u4F53_GB2312", 0, 14);
linemessageFont = new Font("/u5B8B/u4F53_GB2312", 0, 2);
LineColor = Color.blue;
p = new Panel();
exitPanel = new Panel();
queryDisplayer = null;
staticsFrame = new PopFrame(200, 200, 300, 230);
dataLabel1 = new Label(" /u672C/u6B21/u4E0A/u7EBF/u65F6/u523B: ", 1);
dataLabel2 = new Label(" /u672C/u6B21/u4E0A/u7EBF/u65F6/u523B: ", 1);
dataLabel3 = new Label(" /u672C/u6B21/u4E0A/u7EBF/u65F6/u523B: ", 1);
dataLabel4 = new Label(" /u672C/u6B21/u4E0A/u7EBF/u65F6/u523B: ", 1);
user = null;
pw = null;
userID = null;
sock = null;
in = null;
out = null;
win = null;
answer = "";
}
public void init()
{
try
{
win = JSObject.getWindow(this);
}
catch(Exception exception)
{
win = null;
}
gotoLoginLogo();
}
public boolean handleEvent(Event event)
{
if(event != null &&
event.id == 1001)
{
String s = "0";
if(event.target == login.getTextField())
{
password.setTextFieldrequestFocus();
return false;
}
if(event.target == toInternetButton || event.target == password.getTextField())
{
try
{
user = login.getTextField().getText();
pw = password.getTextField().getText();
user = user.trim();
pw = pw.trim();
try
{
if(cookieCheckbox.getState())
setNamecookie(user, pw);
}
catch(NumberFormatException numberformatexception)
{
message.setText("cookie error!");
return false;
}
if(user.length() >= 20 || user.length() == 0)
{
String s1 = " /u7528/u6237/u540D/u9519/u8BEF/uFF01 ";
gotoFaultLogo(s1);
return false;
}
if(pw.length() >= 20 || pw.length() == 0)
{
String s2 = " /u5BC6/u7801/u9519/u8BEF/uFF01 ";
gotoFaultLogo(s2);
return false;
}
answer = "other";
answer = loginToServer(user, pw, s);
if(answer.startsWith("OK!"))
{
StringTokenizer stringtokenizer = new StringTokenizer(answer);
stringtokenizer.nextToken();
userID = new String(stringtokenizer.nextToken());
StrLastOnlineTime = "0";
StrLastOnlineTime = new String(stringtokenizer.nextToken());
if(!StrLastOnlineTime.equalsIgnoreCase("0"))
{
gotoLoginConfirmWindow();
return false;
}
}
else
if(answer.startsWith("failed!"))
{
String s3 = getAllAfterStr(answer, "failed!");
gotoFaultLogo(s3);
return false;
}
else
{
String s4 = " /u767B/u5F55/u670D/u52A1/u5668/u5FD9 !";
gotoFaultLogo(answer);
return false;
}
}
catch(Exception exception)
{
exception.printStackTrace();
String s6 = exception.toString();
gotoFaultLogo(s6);
return false;
}
try
{
gotoDogWatchLogo();
queryDisplayer = new Thread(this);
queryDisplayer.start();
if(win != null)
win.eval("minimizeWindow();");
}
catch(Exception exception1)
{
exception1.printStackTrace();
}
}
else
if(event.target == ConfirmButton)
try
{
gotoDogWatchLogo();
queryDisplayer = new Thread(this);
queryDisplayer.start();
if(win != null)
win.eval("minimizeWindow();");
}
catch(Exception exception2)
{
exception2.printStackTrace();
}
else
if(event.target == logout1Button)
{
answer = logoutToServer();
processLogoutAnswer(answer);
}
else
if(event.target == logoutButton)
{
queryDisplayer.stop();
answer = logoutToServer();
processLogoutAnswer(answer);
}
else
if(event.target == faultBackButton)
{
p.removeAll();
p.validate();
gotoLoginLogo();
p.validate();
}
else
if(event.target == staticsButton)
try
{
answer = null;
answer = statToServer();
processStatAnswer(answer);
}
catch(Exception exception3)
{
exception3.printStackTrace();
}
else
if(event.target == slientCheckbox)
{
if(slientCheckbox.getState())
silentTime.setSelect();
else
silentTime.setUnSelect();
validate();
}
else
if(event.target == cookieCheckbox)
{
String s5 = login.getTextField().getText();
String s7 = password.getTextField().getText();
s5 = s5.trim();
s7 = s7.trim();
try
{
if(cookieCheckbox.getState())
setNamecookie(s5, s7);
else
setNamecookie("", "");
}
catch(NumberFormatException numberformatexception1)
{
message.setText("cookie error!");
return false;
}
}
else
if(event.target == loginhelpButton)
{
if(win != null)
win.eval("openLoginHelpWindow();");
}
else
{
login.getTextField().setText("");
password.getTextField().setText(null);
silentTime.getTextField().setText("5");
login.setTextField("");
password.setTextField("");
validate();
}
}
return false;
}
public void destroy()
{
p.removeAll();
validate();
if(queryDisplayer != null)
{
isRunning = false;
queryDisplayer.stop();
queryDisplayer = null;
}
super.destroy();
}
public boolean initSock()
{
port = 6500;
try
{
server = InetAddress.getByName("10.10.10.73");
sock = new Socket(server, port);
sock.setTcpNoDelay(true);
sock.setSoTimeout(30000);
}
catch(UnknownHostException unknownhostexception)
{
return false;
}
catch(SocketException socketexception)
{
if(sock != null)
try
{
sock.close();
sock = null;
}
catch(IOException ioexception2) { }
return false;
}
catch(IOException ioexception3)
{
return false;
}
try
{
in = new BufferedReader(new InputStreamReader(sock.getInputStream()));
out = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream()));
}
catch(IOException ioexception)
{
try
{
sock.close();
sock = null;
}
catch(IOException ioexception1) { }
return false;
}
return true;
}
public void closeSock()
{
if(sock == null)
return;
try
{
in.close();
out.close();
sock.close();
}
catch(IOException ioexception) { }
sock = null;
}
public String sendMessage(String s)
{
String s1 = "failed! 6";
if(sock == null &&
!initSock())
return "failed! 6";
byte byte0 = -1;
try
{
try
{
String s2 = encode(s);
out.write(s2);
out.flush();
char ac[] = new char[128];
try
{
int i = in.read(ac, 0, 128);
if(i > 0 &&
i < 128)
{
s1 = new String(ac, 0, i);
s1 = decode(s1);
}
}
catch(SocketException socketexception)
{
s1 = new String("failed! 6");
}
catch(IOException ioexception1)
{
s1 = new String("failed! 6");
}
}
catch(IOException ioexception)
{
s1 = new String("failed! 6");
}
}
finally
{
closeSock();
}
return s1;
}
public String loginToServer(String s, String s1, String s2)
{
String s3 = "login " + s + " " + s1 + " " + s2;
String s4 = null;
if(s4 == null)
s4 = sendMessage(s3);
return s4;
}
public String logoutToServer()
{
if(userID == null)
{
return "failed/uFF017";
}
else
{
String s = "logout " + userID;
String s1 = null;
s1 = sendMessage(s);
return s1;
}
}
public String keepliveToServer()
{
if(sock == null)
{
if(!initSock())
return "failed! 6";
closeSock();
}
return "";
}
public String statToServer()
{
if(userID == null)
{
return "failed/uFF01 7";
}
else
{
System.out.print(".");
String s = new String("stat");
s = s + " ";
s = s + userID;
String s1 = sendMessage(s);
return s1;
}
}
public String getAllAfterStr(String s, String s1)
{
String s2 = null;
StringTokenizer stringtokenizer = new StringTokenizer(s);
stringtokenizer.nextToken();
int i = Integer.valueOf(new String(stringtokenizer.nextToken())).intValue();
switch(i)
{
case 1: // '/001'
s2 = " /u5176/u4ED6/u7528/u6237/u5DF2/u7ECF/u767B/u5F55!";
break;
case 2: // '/002'
s2 = " /u7528/u6237/u540D/u3001/u5BC6/u7801/u9519/u8BEF !";
break;
case 3: // '/003'
s2 = "/u5269/u4F59/u65F6/u957F/u4E3A0/uFF0C/u8BF7/u7EED/u8D39!";
break;
case 4: // '/004'
s2 = " /u7528/u6237/u4E0B/u7EBF !";
break;
case 5: // '/005'
s2 = " /u767B/u5F55/u670D/u52A1/u5668/u5FD9 !";
break;
case 6: // '/006'
s2 = " /u901A/u4FE1/u5931/u8D25,/u8BF7/u7A0D/u540E/u64CD/u4F5C !";
break;
case 7: // '/007'
s2 = " /u7528/u6237/u4E0B/u7EBF !";
break;
case 8: // '/b'
s2 = new String(stringtokenizer.nextToken());
break;
}
return s2;
}
public void gotoFaultLogo(String s)
{
String s1 = "";
s1 = s;
p.removeAll();
p.validate();
LogoPanel logopanel = new LogoPanel();
Label label = new Label(" /u767B/u5F55/u9519/u8BEF/u4FE1/u606F", 1);
label.setBackground(TopLabelBackColor);
label.setFont(TopLabelFont);
label.setForeground(TopLabelForeColor);
p.add(logopanel);
logopanel.setBounds(0, 10, 120, 30);
p.add(label);
label.setBounds(120, 10, 180, 30);
Label label1 = new Label(s1, 1);
label1.setForeground(TextForecolor);
label1.setFont(TextLabelFont);
p.add(label1);
label1.setBounds(25, 80, 250, 30);
Panel panel = new Panel();
faultBackButton = new Button(" /u8FD4/u56DE/u767B/u5F55/u7A97/u53E3 ");
faultBackButton.setBackground(buttoncolor);
faultBackButton.setFont(TextLabelFont);
panel.add(faultBackButton);
p.add(panel);
panel.setBounds(25, 130, 250, 30);
BottomLabelPanel bottomlabelpanel = new BottomLabelPanel();
p.add(bottomlabelpanel);
bottomlabelpanel.setBounds(0, 190, 320, 10);
validate();
}
public void gotoLoginLogo()
{
removeAll();
p.removeAll();
validate();
setBackground(TextBackcolor);
BorderLayout borderlayout = new BorderLayout();
setLayout(borderlayout);
p.setLayout(null);
LogoPanel logopanel = new LogoPanel();
Label label = new Label(" /u6B22/u8FCE/u767B/u5165/u7F51/u7EDC", 1);
label.setBackground(TopLabelBackColor);
label.setFont(TopLabelFont);
label.setForeground(TopLabelForeColor);
p.add(logopanel);
logopanel.setBounds(0, 10, 120, 30);
p.add(label);
label.setBounds(120, 10, 180, 30);
Panel panel = new Panel();
GridLayout gridlayout = new GridLayout(3, 1, -5, -6);
panel.setLayout(gridlayout);
login = new LabeledTextField("/u5E10 /u53F7/uFF1A ", TextLabelFont, 18, TextLabelFont);
panel.add(login);
password = new LabeledTextField("/u5BC6 /u7801/uFF1A ", TextLabelFont, 18, TextLabelFont);
password.getTextField().setEchoCharacter('*');
panel.add(password);
Panel panel1 = new Panel();
panel1.setLayout(new BorderLayout());
Label label1 = new Label(" ", 1);
label1.setFont(TextLabelFont);
panel1.add(label1, "West");
cookieCheckbox = new Checkbox("/u4FDD/u5B58/u5BC6/u7801");
panel1.add(cookieCheckbox, "Center");
panel.add(panel1);
p.add(panel);
panel.setBounds(5, 55, 250, 100);
toInternetButton = new Button(" /u767B/u5F55/u4E0A/u7F51 ");
toInternetButton.setBackground(buttoncolor);
toInternetButton.setFont(TextLabelFont);
quitButton = new Button(" /u91CD/u586B ");
quitButton.setBackground(buttoncolor);
quitButton.setFont(TextLabelFont);
loginhelpButton = new Button("/u5E2E/u52A9/u624B/u518C");
loginhelpButton.setBackground(buttoncolor);
loginhelpButton.setFont(TextLabelFont);
p.add(toInternetButton);
toInternetButton.setBounds(30, 160, 70, 25);
p.add(quitButton);
quitButton.setBounds(120, 160, 50, 25);
p.add(loginhelpButton);
loginhelpButton.setBounds(190, 160, 70, 25);
BottomLabelPanel bottomlabelpanel = new BottomLabelPanel();
p.add(bottomlabelpanel);
bottomlabelpanel.setBounds(0, 190, 320, 10);
String s = getCookie();
String s1 = "";
String s2 = "";
if(!s.equalsIgnoreCase("") &amp;&amp;
!s.equalsIgnoreCase("/"))
{
int i = s.indexOf("/");
s1 = s.substring(0, i);
s2 = s.substring(i + 1);
cookieCheckbox.setState(true);
}
login.setTextField(s1);
password.setTextField(s2);
login.setTextFieldrequestFocus();
p.validate();
add(p, "Center");
}
public void gotoLoginConfirmWindow()
{
p.removeAll();
validate();
LogoPanel logopanel = new LogoPanel();
Label label = new Label(" /u7528/u6237/u767B/u5F55/u786E/u8BA4/u4FE1/u606F", 1);
label.setBackground(TopLabelBackColor);
label.setFont(TopLabelFont);
label.setForeground(TopLabelForeColor);
p.add(logopanel);
logopanel.setBounds(0, 10, 120, 30);
p.add(label);
label.setBounds(120, 10, 180, 30);
Label label1 = new Label("/u60A8/u5DF2/u7ECF/u767B/u5F55/uFF0C/u662F/u5426/u4FDD/u6301/u767B/u5F55/u72B6/u6001/uFF1F", 1);
label1.setForeground(TextForecolor);
label1.setFont(TextLabelFont);
p.add(label1);
label1.setBounds(30, 80, 250, 30);
Panel panel = new Panel();
ConfirmButton = new Button(" /u4FDD/u6301/u767B/u5F55/u72B6/u6001 ");
ConfirmButton.setBackground(buttoncolor);
ConfirmButton.setFont(TextLabelFont);
Label label2 = new Label(" ", 1);
label2.setFont(TextLabelFont);
logout1Button = new Button(" /u4E0B/u7F51 ");
logout1Button.setBackground(buttoncolor);
logout1Button.setFont(TextLabelFont);
panel.add(ConfirmButton);
panel.add(label2);
panel.add(logout1Button);
p.add(panel);
panel.setBounds(20, 130, 300, 30);
BottomLabelPanel bottomlabelpanel = new BottomLabelPanel();
p.add(bottomlabelpanel);
bottomlabelpanel.setBounds(0, 190, 320, 10);
validate();
}
public void gotoDogWatchLogo()
{
p.removeAll();
p.validate();
LogoPanel logopanel = new LogoPanel();
Label label = new Label(" /u7528/u6237/u5728/u7EBF/u72B6/u6001", 1);
label.setBackground(TopLabelBackColor);
label.setFont(TopLabelFont);
label.setForeground(TopLabelForeColor);
p.add(logopanel);
logopanel.setBounds(0, 10, 120, 30);
p.add(label);
label.setBounds(120, 10, 180, 30);
Panel panel = new Panel();
panel.setLayout(new BorderLayout());
NameLeftTextField = new LabeledLeftTextField("/u5728 /u7EBF /u7528 /u6237 :", TextLabelFont, 16, TextLabelFont);
NameLeftTextField.setTextFieldEditDisable();
panel.add(NameLeftTextField, "West");
NameLeftTextField.getTextField().setText(user);
p.add(panel);
panel.setBounds(25, 55, 290, 35);
Panel panel1 = new Panel();
panel1.setLayout(new BorderLayout());
loginTime = new LabeledLeftTextField("/u672C/u6B21/u4E0A/u7EBF/u65F6/u523B:", TextLabelFont, 16, TextLabelFont);
loginTime.setTextFieldEditDisable();
panel1.add(loginTime, "West");
loginTime.getTextField().setText("0/u5C0F/u65F60/u5206/u949F0/u79D2 ");
p.add(panel1);
panel1.setBounds(25, 91, 290, 35);
Panel panel2 = new Panel();
staticsButton = new Button(" /u67E5/u770B/u8BE6/u7EC6/u4FE1/u606F ");
staticsButton.setFont(TextLabelFont);
staticsButton.setBackground(buttoncolor);
panel2.add(staticsButton);
Label label1 = new Label(" ", 1);
label1.setFont(TextLabelFont);
panel2.add(label1);
logoutButton = new Button(" /u7528/u6237/u4E0B/u7F51 ");
logoutButton.setBackground(buttoncolor);
logoutButton.setFont(TextLabelFont);
panel2.add(logoutButton);
p.add(panel2);
panel2.setBounds(0, 125, 300, 30);
BottomLabelPanel bottomlabelpanel = new BottomLabelPanel();
p.add(bottomlabelpanel);
bottomlabelpanel.setBounds(0, 190, 320, 10);
p.validate();
}
public void gotoExitLogo(String s, String s1, String s2, String s3, String s4)
{
p.removeAll();
validate();
LogoPanel logopanel = new LogoPanel();
Label label = new Label(" /u7528/u6237/u4E0B/u7EBF/u8BE6/u7EC6/u4FE1/u606F", 1);
label.setBackground(TopLabelBackColor);
label.setFont(TopLabelFont);
label.setForeground(TopLabelForeColor);
p.add(logopanel);
logopanel.setBounds(0, 10, 120, 30);
p.add(label);
label.setBounds(120, 10, 180, 30);
BorderLayout borderlayout = new BorderLayout();
Panel panel = new Panel();
panel.setLayout(borderlayout);
Panel panel1 = new Panel();
GridLayout gridlayout = new GridLayout(4, 1, 1, 1);
panel1.setLayout(gridlayout);
Label label1 = new Label("/u5E10/u53F7/u5F53/u524D/u72B6/u6001: ", 2);
Label label2 = new Label("/u672C/u6B21/u63A5/u6536/u5B57/u8282: ", 2);
Label label3 = new Label("/u672C/u6B21/u53D1/u9001/u5B57/u8282: ", 2);
Label label4 = new Label("/u672C/u6B21/u4E0A/u7F51/u65F6/u957F: ", 2);
label1.setFont(TextLabelFont);
label2.setFont(TextLabelFont);
label3.setFont(TextLabelFont);
label4.setFont(TextLabelFont);
Color color = new Color(172, 172, 172);
panel1.add(label1);
panel1.add(label2);
panel1.add(label3);
panel1.add(label4);
panel.add(panel1, "West");
Panel panel2 = new Panel();
GridLayout gridlayout1 = new GridLayout(4, 1, 1, 1);
panel2.setLayout(gridlayout1);
Label label5 = new Label(s, 0);
Label label6 = new Label(s1, 0);
Label label7 = new Label(s2, 0);
Label label8 = new Label(s4, 0);
label5.setFont(TextLabelFont);
label6.setFont(TextLabelFont);
label7.setFont(TextLabelFont);
label8.setFont(TextLabelFont);
label5.setBackground(color);
label6.setBackground(color);
label7.setBackground(color);
label8.setBackground(color);
panel2.add(label5);
panel2.add(label6);
panel2.add(label7);
panel2.add(label8);
panel.add(panel2, "East");
p.add(panel);
panel.setBounds(30, 55, 250, 125);
validate();
}
public void popStatWindow(String s, String s1, String s2, String s3)
{
staticsFrame.removeAll();
validate();
staticsFrame.addCloseBotton();
staticsFrame.setLayout(new BorderLayout());
LogoPanel logopanel = new LogoPanel();
Label label = new Label(" /u5728/u7EBF/u8BE6/u7EC6/u4FE1/u606F", 0);
label.setBackground(TopLabelBackColor);
label.setFont(TopLabelFont);
label.setForeground(TopLabelForeColor);
Panel panel = new Panel();
Panel panel1 = new Panel();
panel1.add(label);
label.setBounds(120, 10, 180, 30);
panel.add(panel1);
Panel panel2 = new Panel();
Panel panel3 = new Panel();
GridLayout gridlayout = new GridLayout(4, 1, 1, 1);
panel3.setLayout(gridlayout);
Label label1 = new Label(" /u5E10/u53F7/u5F53/u524D/u72B6/u6001:", 0);
Label label2 = new Label(" /u672C/u6B21/u63A5/u6536/u5B57/u8282(k):", 0);
Label label3 = new Label(" /u672C/u6B21/u53D1/u9001/u5B57/u8282(k):", 0);
Label label4 = new Label(" /u672C/u6B21/u767B/u5F55/u65F6/u957F:", 0);
label1.setFont(TextLabelFont);
label2.setFont(TextLabelFont);
label3.setFont(TextLabelFont);
label4.setFont(TextLabelFont);
Color color = new Color(172, 172, 172);
panel3.add(label1);
panel3.add(label2);
panel3.add(label3);
panel3.add(label4);
Panel panel4 = new Panel();
panel4.setLayout(gridlayout);
Label label5 = new Label(s, 0);
Label label6 = new Label(s1, 0);
Label label7 = new Label(s2, 0);
s3 = s3 + " ";
Label label8 = new Label(s3, 0);
label5.setFont(TextLabelFont);
label6.setFont(TextLabelFont);
label7.setFont(TextLabelFont);
label8.setFont(TextLabelFont);
label5.setBackground(color);
label6.setBackground(color);
label7.setBackground(color);
label8.setBackground(color);
panel4.add(label5);
panel4.add(label6);
panel4.add(label7);
panel4.add(label8);
Panel panel5 = new Panel();
panel5.setLayout(gridlayout);
Label label9 = new Label(" ", 0);
Label label10 = new Label(" ", 0);
Label label11 = new Label(" ", 0);
Label label12 = new Label(" ", 0);
label9.setFont(TextLabelFont);
label10.setFont(TextLabelFont);
label11.setFont(TextLabelFont);
label12.setFont(TextLabelFont);
panel5.add(label9);
panel5.add(label10);
panel5.add(label11);
panel5.add(label12);
panel2.add(panel3);
panel2.add(panel4);
staticsFrame.add(panel, "North");
staticsFrame.add(panel2, "Center");
staticsFrame.pack();
staticsFrame.show();
p.validate();
}
public void processLogoutAnswer(String s)
{
String s1 = "/u4E0B/u7EBF";
String s2 = "555555";
String s3 = "444444";
String s4 = "2222";
String s5 = "122121212";
if(s.startsWith("OK!"))
{
StringTokenizer stringtokenizer = new StringTokenizer(s);
int i = 0;
String as[] = new String[7];
while(stringtokenizer.hasMoreTokens())
if(++i < 3)
stringtokenizer.nextToken();
else
as[i - 3] = stringtokenizer.nextToken();
if(!as[0].equalsIgnoreCase("0"));
if(as[3].equalsIgnoreCase("1"))
s1 = "/u60A8/u88AB/u8D85/u65F6/u4E0B/u7EBF";
if(as[4].equalsIgnoreCase("1"))
s1 = "/u60A8/u88AB/u5F3A/u5236/u4E0B/u7EBF";
s2 = convert(as[1]);
s3 = convert(as[2]);
int j = (int)Long.parseLong(as[6], 10);
int k = j / 3600;
int l = (j % 3600) / 60;
int i1 = j % 60;
s4 = k + "/u5C0F/u65F6 " + l + "/u5206/u949F " + i1 + "/u79D2 ";
j = (int)Long.parseLong(as[5], 10);
k = j / 3600;
l = (j % 3600) / 60;
i1 = j % 60;
s5 = k + "/u5C0F/u65F6 " + l + "/u5206/u949F " + i1 + "/u79D2 ";
}
else
if(s.startsWith("failed!"))
{
String s6 = getAllAfterStr(s, "failed!");
s1 = "/u4E0B/u7EBF";
s2 = "0";
s3 = "0";
s4 = "0";
s5 = "0";
}
else
{
return;
}
p.removeAll();
p.validate();
gotoExitLogo(s1, s2, s3, s4, s5);
p.validate();
}
public void processStatAnswer(String s)
{
String s1 = "5555555555555555555555";
String s3 = "44445555555555555555544";
String s5 = "/u5728/u7EBF";
String s6 = "2222";
String s8 = "122121212";
String s9 = "122121212";
if(s != null &amp;&amp;
s.startsWith("OK!"))
{
StringTokenizer stringtokenizer = new StringTokenizer(s);
int i = 0;
String as[] = new String[7];
while(stringtokenizer.hasMoreTokens())
if(++i < 3)
stringtokenizer.nextToken();
else
as[i - 3] = stringtokenizer.nextToken();
if(as[0].equalsIgnoreCase("0"))
s5 = "/u60A8/u5DF2/u7ECF/u4E0B/u7EBF";
if(as[3].equalsIgnoreCase("1"))
s5 = "/u60A8/u88AB/u8D85/u65F6/u4E0B/u7EBF";
if(as[4].equalsIgnoreCase("1"))
s5 = "/u60A8/u88AB/u5F3A/u5236/u4E0B/u7EBF";
String s2 = convert(as[1]);
String s4 = convert(as[2]);
int j = (int)Long.parseLong(as[5], 10);
int k = j / 3600;
int l = (j % 3600) / 60;
int i1 = j % 60;
String s10 = k + "/u5C0F/u65F6 " + l + "/u5206/u949F " + i1 + "/u79D2 ";
if(as[0].compareTo("0") == 0 || as[3].compareTo("1") == 0 || as[4].compareTo("1") == 0)
{
String s7 = as[6];
p.removeAll();
p.validate();
gotoExitLogo(s5, s2, s4, s7, s10);
return;
}
else
{
popStatWindow(s5, s2, s4, s10);
return;
}
}
if(s != null &amp;&amp;
s.startsWith("failed!"))
{
StringTokenizer stringtokenizer1 = new StringTokenizer(s);
stringtokenizer1.nextToken();
String s11 = new String(stringtokenizer1.nextToken());
if(s11.equalsIgnoreCase("8"))
{
gotoExitLogo("/u60A8/u5DF2/u7ECF/u4E0B/u7EBF", "0", "0", "0", "0");
return;
}
else
{
return;
}
}
else
{
popStatWindow("/u8BF7/u7A0D/u540E/u67E5/u8BE2", "null", "null", "null");
return;
}
}
public void run()
{
boolean flag = true;
boolean flag1 = false;
loginTime.getTextField().setText("0");
Date date = new Date();
long l = date.getTime();
l -= Long.parseLong(StrLastOnlineTime, 10) * 1000L;
date = new Date(l);
String s = (date.getYear() + 1900) + "/" + (date.getMonth() + 1) + "/" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
loginTime.getTextField().setText(s);
p.validate();
for(isRunning = true;
isRunning &amp;&amp;
loginTime != null;)
{
answer = keepliveToServer();
pause(240D);
}
}
public void pause(double d)
{
try
{
Thread.sleep((long)(d * 1000D));
}
catch(InterruptedException interruptedexception) { }
}
public String convert(String s)
{
long l = Long.parseLong(s, 10);
if(l <= 1000L)
{
s = "1";
}
else
{
if(l % 1000L < 500L)
l /= 1000L;
else
if(l % 1000L >= 500L)
l = l / 1000L + 1L;
s = Long.toString(l);
}
String s1 = "";
int i = s.length() % 3;
if(i == 1)
s = " " + s;
if(i == 2)
s = " " + s;
i = s.length();
for(int j = 0;
j < i;
j += 3)
if(j + 3 == i)
s1 = s1 + s.substring(j, j + 3);
else
s1 = s1 + s.substring(j, j + 3) + ",";
s1 = s1 + " k";
s1 = s1.trim();
return s1;
}
public String encode(String s)
{
byte abyte0[];
try
{
abyte0 = s.getBytes("GBK");
}
catch(IOException ioexception)
{
try
{
abyte0 = s.getBytes("ISO-8859-1");
}
catch(IOException ioexception1)
{
return "/u64CD/u4F5C/u7CFB/u7EDF/u4E0D/u517C/u5BB9";
}
}
for(int i = 0;
i < abyte0.length;
i++)
{
int j = (abyte0 &amp;
0x3) << 2;
int k = (abyte0 &amp;
0xc) >> 2;
int i1 = abyte0 &amp;
0xf0;
abyte0 = (byte)(j | k | i1);
abyte0 = (byte)(abyte0 + 1);
}
byte abyte1[] = new byte[abyte0.length];
for(int l = 0;
l < abyte0.length;
l++)
abyte1[l] = abyte0[l];
String s1 = null;
try
{
s1 = new String(abyte1, "GBK");
}
catch(IOException ioexception2)
{
try
{
s1 = new String(abyte1, "ISO-8859-1");
}
catch(IOException ioexception3)
{
return "/u64CD/u4F5C/u7CFB/u7EDF/u4E0D/u517C/u5BB9";
}
}
return s1;
}
public String decode(String s)
{
byte abyte0[];
try
{
abyte0 = s.getBytes("GBK");
}
catch(IOException ioexception)
{
try
{
abyte0 = s.getBytes("ISO-8859-1");
}
catch(IOException ioexception1)
{
return "/u64CD/u4F5C/u7CFB/u7EDF/u4E0D/u517C/u5BB9";
}
}
for(int i = 0;
i < abyte0.length;
i++)
{
abyte0 = (byte)(abyte0 - 1);
int j = (abyte0 &amp;
0x3) << 2;
int k = (abyte0 &amp;
0xc) >> 2;
int l = abyte0 &amp;
0xf0;
abyte0 = (byte)(j | k | l);
}
String s1 = null;
try
{
s1 = new String(abyte0, "GBK");
}
catch(IOException ioexception2)
{
try
{
s1 = new String(abyte0, "ISO-8859-1");
}
catch(IOException ioexception3)
{
return "/u64CD/u4F5C/u7CFB/u7EDF/u4E0D/u517C/u5BB9";
}
}
if(s1.startsWith("failed! 8 "))
s1 = s.substring(10);
return s1;
}
public boolean setNamecookie(String s, String s1)
{
String s2 = "setCookie";
String s3 = s + "/" + s1;
String as[] = {
s3
};
if(win != null)
win.call(s2, as);
return true;
}
public String getCookie()
{
JSObject jsobject = JSObject.getWindow(this);
JSObject jsobject1 = (JSObject)jsobject.getMember("document");
String s = "";
s = (String)jsobject1.getMember("cookie");
s = "begin
" + s;
if(!s.equalsIgnoreCase(""))
{
String s1 = "magic=";
int i = s.indexOf(s1);
if(i != -1)
{
i += s1.length();
int j = s.indexOf(";", i);
if(j == -1)
j = s.length();
return s.substring(i, j);
}
else
{
return "";
}
}
else
{
return "";
}
}
}
 
有什么问题吗,朋友
 
中文乱码
改用Oracle817的JDBC驱动则无问题
 
hehe. 估计是你的字段类型不对吧。
使用816的驱动,如果字段是char的话,中文就会不对。
改用817则没有问题。
 
一个三层系统的客户端,用socket相连中间层
 
好长的代码呀 看的头晕
 
接受答案了.
 
后退
顶部