请问这个windows console 控制台效果怎么实现?

AKULAKK 2007-10-26 11:57:27
windows console命令模式俗称dos模式

那么 我曾经看到一种在dos模式下运行的服务器窗口,运行中的时候,提示信息末尾有个提示符按照 [\] ->[|] ->[/] ->[-] 依次变换,进而形成转动的"动画"...

相信各位看到过吧? 试问这种"特效"是怎么实现的呢?

第二个问题是,在dos模式下运行的java程序,怎么像CS(反恐精英)服务器那样持续捕捉用户的输入呢?
好比一个服务器在运行,我直接输入 show user (回车) 直接可以看到查询结果...酱紫.

请赐教!感激万分.
...全文
87 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
StudentIT 2007-10-26
  • 打赏
  • 举报
回复
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
* @author Zhangql
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class Dos {
public static void main(String[] args) throws IOException {
Dos enterConsole = new Dos();
enterConsole.printConsoleChar();
}

/**
* 从控制对接收一行字符串,然后输出到控制台
* @throws IOException
*/
public void printConsoleLine() throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str = null;
System.out.println("Enter your value:");
str = br.readLine();
System.out.println("your value is :" + str);
}

/**
* 从控制台接收一个字符
* 然后打印到控制台上
* @throws IOException
*/
public void printConsoleChar() throws IOException {
System.out.print("Enter a Char:");
char i = (char) System.in.read();
System.out.println("your char is :" + i);
}
}

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧