当前位置: 技术问答>java相关
我是哪个初学java的冷雪儿,由于我的帐号分数太少,所以另换了一个帐号,我现在有一段程序,有很多地方不懂,各路大虾不妨进来帮我看看,
来源: 互联网 发布时间:2015-10-18
本文导语: import java.applet.*; import java.awt.*; import java.io.*; import java.net.*; import java.util.*; public class TelnetApp extends Applet implements Runnable{ Thread client; TextArea log; TextField hostname; TextField userid; TextField password; Label hname; La...
import java.applet.*;
import java.awt.*;
import java.io.*;
import java.net.*;
import java.util.*;
public class TelnetApp extends Applet implements Runnable{
Thread client;
TextArea log;
TextField hostname;
TextField userid;
TextField password;
Label hname;
Label uid;
Label psd;
Button connect;
Button bye;
int wantTime;
boolean logged;
Socket socket = null;
PrintStream os;
DataInputStream is;
public TelnetApp(){
}
public void init(){
resize(400,300);
setLayout(new BorderLayout());
Panel pl = new Panel();
log = new TextArea(10,80);
log.setEditable(false);
pl.add(log);
add("North",pl);
Panel p2 = new Panel();
p2.add(hname = new Label("Hostname:"));
p2.add(hostname = new TextField(20));
p2.add(uid =new Label("Userid:"));
p2.add(userid = new TextField(10));
p2.add(psd = new Label("password:"));
p2.add(password = new TextField(10));
password.setEchoCharacter('*');
add("Center",p2);
Panel p3 = new Panel();
p3.add(connect = new Button("Connect"));
p3.add(bye = new Button("Bye"));
bye.disable();
add("South",p3);
logged = false;
}
public void run(){
String fromServer = null;
byte b[] = new byte[3];
b[0] = (byte)'n';
while(true){
if ((fromServer = getData())!=null)
log.appendText(fromServer+"n");
if (wantTime
import java.awt.*;
import java.io.*;
import java.net.*;
import java.util.*;
public class TelnetApp extends Applet implements Runnable{
Thread client;
TextArea log;
TextField hostname;
TextField userid;
TextField password;
Label hname;
Label uid;
Label psd;
Button connect;
Button bye;
int wantTime;
boolean logged;
Socket socket = null;
PrintStream os;
DataInputStream is;
public TelnetApp(){
}
public void init(){
resize(400,300);
setLayout(new BorderLayout());
Panel pl = new Panel();
log = new TextArea(10,80);
log.setEditable(false);
pl.add(log);
add("North",pl);
Panel p2 = new Panel();
p2.add(hname = new Label("Hostname:"));
p2.add(hostname = new TextField(20));
p2.add(uid =new Label("Userid:"));
p2.add(userid = new TextField(10));
p2.add(psd = new Label("password:"));
p2.add(password = new TextField(10));
password.setEchoCharacter('*');
add("Center",p2);
Panel p3 = new Panel();
p3.add(connect = new Button("Connect"));
p3.add(bye = new Button("Bye"));
bye.disable();
add("South",p3);
logged = false;
}
public void run(){
String fromServer = null;
byte b[] = new byte[3];
b[0] = (byte)'n';
while(true){
if ((fromServer = getData())!=null)
log.appendText(fromServer+"n");
if (wantTime
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。