Topic: 怎么样在控制台实现清屏???? |
Print this page |
1.怎么样在控制台实现清屏???? | Copy to clipboard |
Posted by: nationalist Posted on: 2006-09-18 17:30 比如我要实现让 1 自动每隔一秒钟就加 1 ,也就是在同一个位置变成1,2,3,4,5... 而不是那样一排排的打印出来 就象C++里面的system(csl); 在java 里面怎么做啊? |
2.Re:怎么样在控制台实现清屏???? [Re: nationalist] | Copy to clipboard |
Posted by: jackchengen Posted on: 2006-09-18 19:52 用定时器Timer和运行时Runtime. 定时器实现定时刷行,Runtime调用本地方法cls实现清屏。不过我觉得这种方法是否太复杂了~ 大家是否还有其他的方法? |
3.Re:怎么样在控制台实现清屏???? [Re: nationalist] | Copy to clipboard |
Posted by: lisliefor Posted on: 2006-09-19 11:18 LZ want to write a program about clock ? why do you decide to showing on Console ? you can paint on canvas ! I do it before , if you want .... |
4.Re:怎么样在控制台实现清屏???? [Re: nationalist] | Copy to clipboard |
Posted by: JiafanZhou Posted on: 2006-09-19 19:05 就让我来回答你的问题,真好让我复习一下JNI 基本上你要实现在Java的console上面是不太可能的。。有人实现了希望告诉我一下阿。(我对console和gui不是很熟的,我不是专门搞这个的) 1.写一段Java代码。
基本上注释很全的,我就不解释了。 然后compile 2.生成 .h file javah -jni com.console.IncrementOneEvery1Sec (fully qualified modifier) 3.Native Method Implementation (这里就我们的可爱的C了)
注意要用到stdlib这个头文件噢,不要忘了。 4.用gcc或者cl生成dll..(我用的是CL)
5.好拉,下面就可以用了。 (不要在Eclipse里面运行,好象有点问题的) java -Djava.library.path=<yourDllFolder> <YourClass> e.g. java -Djava.library.path=C:\cjsdn\cjsdn\clib\cjsdn com.console.IncrementOneEvery1Sec (我这里的cmd) 能看出我是用心写的。。斑竹加分阿。 嘉帆 |
5.Re:怎么样在控制台实现清屏???? [Re: HenryShanley] | Copy to clipboard |
Posted by: lisliefor Posted on: 2006-09-20 12:47 HenryShanley wrote: Haha , we have caught your essence ! |
6.Re:怎么样在控制台实现清屏???? [Re: nationalist] | Copy to clipboard |
Posted by: JiafanZhou Posted on: 2006-09-20 16:19 Come on, where are all the moderators? they need to take care of here.. Jiafan |
7.Re:怎么样在控制台实现清屏???? [Re: lisliefor] | Copy to clipboard |
Posted by: zcjl Posted on: 2006-09-20 17:34 lisliefor wrote: 本来面目: [ běn lái miàn mù ] 1. true colors 2. true features 其它相关解释: <for what they are> 例句与用法: 1. 他一掌了权就露出了本来面目. Once he achieved power he showed (himself in) his true colours. |
8.Re:怎么样在控制台实现清屏???? [Re: zcjl] | Copy to clipboard |
Posted by: JiafanZhou Posted on: 2006-09-21 06:08 zcjl wrote: What? |
9.Re:怎么样在控制台实现清屏???? [Re: HenryShanley] | Copy to clipboard |
Posted by: zcjl Posted on: 2006-09-21 08:28 HenryShanley wrote: 我想lisliefor是想表达一个“本来面目”的意思,所以帮他查了一下词典和例句 hah |
10.Re:怎么样在控制台实现清屏???? [Re: zcjl] | Copy to clipboard |
Posted by: lisliefor Posted on: 2006-09-21 10:59 zcjl wrote: Thanks ! I want to say "catch your '本质'" ! In my team , our boss used to say it . I save the '帖子' ! Introduce some good dictionary about Chinest-to-English for me please! Thanks ! |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |