📄 chatdisplaythread.java
字号:
// Yura Mamyrin, Group D
package risk.engine;
import java.io.*;
import java.net.*;
import java.awt.*;
/**
* <p> Display Thread </p>
* @author Yura Mamyrin
*/
// This thread reads in input stream from a socket and
// appends the output to a TextArea object
public class ChatDisplayThread extends Thread {
Risk risk;
BufferedReader inChat = null;
ChatDisplayThread (Risk r, BufferedReader in)
{
risk = r;
inChat = in;
}
public void run() {
//System.out.println("Start DisplayThread ");
String str;
boolean badexit=true;
try {
while ((str = inChat.readLine()) != null)
{
if (str.length() > 0)
{
risk.GameParser(str);
}
}
}
catch (IOException e) {
//System.out.println("inChat received an IOException: "+
//e.getMessage());
//e.printStackTrace();
if ("Stream closed".equals( e.getMessage() ) ) { badexit=false; }
}
//System.out.println("Display Thread Finishing");
if (badexit) { risk.kickedOff(); }
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -