編集:この機能は、 !の
clearScreen
メソッドを呼び出したときにのみ発生します。ConsoleReader
その他の変更は効果がありません。これは JLine2 のバグですか?
JLine2:
これを実行すると、2 つのコンソール プロンプトが連続して表示されるのはなぜですか ( ----> ---->
)? 2 つのコンソールが作成されているためでしょうか。方法がわかりません。
ここで何が見えないのですか?
import java.io.IOException;
import jline.console.ConsoleReader;
class TextUi implements Ui {
private static final String prompt1 = "----> ";
public void homeScreen() {
try {
ConsoleReader con = new ConsoleReader();
con.setPrompt(prompt1);
con.clearScreen();
System.out.println("Press any key to continue...");
con.readCharacter();
con.clearScreen();
System.out.println("Here is a prompt. Do something and press enter to continue...");
String line = con.readLine();
con.clearScreen();
System.out.println("You typed: ");
System.out.println(line);
System.out.println("Press any key to exit. ");
con.readCharacter();
con.clearScreen();
} catch (IOException e) {
e.printStackTrace();
}
}
public void exitSplash() {
System.out.println("Thank You. Goodbye.");
System.out.println("");
}
public void creditsScreen() {
}
public static void main (String argv[]) {
TextUi ui = new TextUi();
ui.homeScreen();
ui.exitSplash();
}
}