Page 762 - 3-2
P. 762
if(actionCommand.equals("X"))
try
{
txt.setText(txt.getText(0,txt.getText().length()-1));
} catch (BadLocationException e1)
{
e1.printStackTrace();
}
else if(actionCommand.equals("ok"))
this.setVisible(false);
e l s e
if(Integer.parseInt(actionCommand)>=0||Integer.parseInt(actionCommand)<=9)
txt.setText(txt.getText()+actionCommand);
}
}
}
< ReceiveThread.java >
package com.example.user.appclient;
import java.io.*;
import java.net.*;
public class ReceiveThread extends Thread {
Socket socket;
ObjectInputStream in;
static boolean go;
public ReceiveThread (Socket socket)
{
this.socket = socket;
}
public void run()
{
Member mb = null;
try{
in = new ObjectInputStream(socket.getInputStream());
while(true){
mb = (Member) in.readObject();
if(mb != null){
System.out.println(mb);
System.out.println(".");
- 762 -