以下例程输出从国际象棋引擎移动到 JTextArea
public void getEngineOutputOriginal(Process engine)
{
try {
BufferedReader reader =
new BufferedReader (new InputStreamReader (engine.getInputStream ()), 1);
String lineRead = null;
// send engine analysis to print method
while ((lineRead = reader.readLine ()) != null)
Application.showEngineAnalysis (lineRead);
}
catch (Exception e) {
e.printStackTrace();
}
}
样本输出将是
12 3.49 39/40? 2. b4 (656Knps)
12 3.49 40/40? 2. Nd5 (656Knps)
12-> 3.51 0.04 2. Bxf4 Be6 3. Be3 Qa5 4. Nd5 Qxd2
13 3.51 1/40? 2. Bxf4 (655Knps)
是否可以反转该过程,以便读取的最后一行始终出现在顶部而不是底部,如下所示:
13 3.51 1/40? 2. Bxf4 (655Knps)
12-> 3.51 0.04 2. Bxf4 Be6 3. Be3 Qa5 4. Nd5 Qxd2
12 3.49 40/40? 2. Nd5 (656Knps)
12 3.49 39/40? 2. b4 (656Knps)
我研究了谷歌,但找不到解决方案