📄 maskingthread.java
字号:
/* * MaskingThread.java * * Created on April 5, 2005, 5:25 PM */package jwsgrid.util.priv;import java.io.*;/** * This class attempts to erase characters echoed to the console. */public class MaskingThread extends Thread { private boolean stop = false; private int index; private String prompt; /** *@param prompt The prompt displayed to the user */ public MaskingThread( String prompt ) { this.prompt = prompt; } /** * Begin masking until asked to stop. */ public void run() { while ( !stop ) { try { // attempt masking at this rate this.sleep( 1 ); } catch ( InterruptedException iex ) { iex.printStackTrace(); } if ( !stop ) { System.out.print( "\r" + prompt + " \r" + prompt ); } System.out.flush(); } } /** * Instruct the thread to stop masking. */ public void stopMasking() { this.stop = true; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -