俊星的BLOG
導(dǎo)航
BlogJava
首頁
新隨筆
聯(lián)系
聚合
管理
<
2009年6月
>
日
一
二
三
四
五
六
31
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
1
2
3
4
5
6
7
8
9
10
11
統(tǒng)計
隨筆 - 50
文章 - 0
評論 - 6
引用 - 0
常用鏈接
我的隨筆
我的評論
我的參與
最新評論
留言簿
(1)
給我留言
查看公開留言
查看私人留言
隨筆分類
代碼庫(7)
(rss)
隨筆檔案
2010年11月 (3)
2010年10月 (12)
2009年6月 (5)
2009年5月 (22)
2009年4月 (8)
最新隨筆
1.?實(shí)現(xiàn)變更統(tǒng)計
2.?切換IE8中碰到的問題
3.?發(fā)布FWMS
4.?ActiveMQ初探
5.?CAS初步配置
搜索
最新評論
1.?re: JAVA圖像縮放處理[未登錄]
不錯的方法
--test
2.?re: freetts初探
學(xué)習(xí)了! 就是不清楚為啥在eclipse下跑不起來...
--apiao
3.?re: freetts初探
System property "mbrola.base" is undefined. Will not use MBROLA voices.
這個問題怎么解決啊?
--瓏兒
4.?re: ActiveMQ初探
測試通過。多謝
--71569973
5.?登錄網(wǎng)站
評論內(nèi)容較長,點(diǎn)擊標(biāo)題查看
--ahome
閱讀排行榜
1.?ftp的port和pasv模式(轉(zhuǎn))(8030)
2.?JAVA圖像縮放處理(4180)
3.?Nutz初步試用(4109)
4.?Window下FTP命令使用(3518)
5.?freetts初探(3429)
6.?ActiveMQ初探(2906)
7.?MYSQL Access denied 問題的解決(2345)
8.?HTTP Client及HTTPS初探(1989)
9.?JAVA單向加密(MD5,SHA,MAC)(1266)
10.?CAS認(rèn)證初探(1152)
評論排行榜
1.?freetts初探(2)
2.?HTTP Client及HTTPS初探(2)
3.?ActiveMQ初探(1)
4.?JAVA圖像縮放處理(1)
5.?我的DWR之DefaultContainer(0)
SWT試用之控制鼠標(biāo)鍵盤
通過SWT可以控制鼠標(biāo)鍵盤事件,具體如下:
import
org.eclipse.swt.SWT;
import
org.eclipse.swt.widgets.Display;
import
org.eclipse.swt.widgets.Event;
import
org.eclipse.swt.widgets.Shell;
import
org.eclipse.swt.widgets.Text;
/** */
/**
* 預(yù)期的運(yùn)行效果為:顯示開始菜單
*
@author
kinkding
* @history 2009-6-2
*/
public
class
MyEventRes
{
public
static
void
main(String[] args)
{
final
Display display
=
new
Display();
final
Shell shell
=
new
Shell(display);
final
Text text
=
new
Text(shell, SWT.BORDER);
text.setSize(text.computeSize(
150
, SWT.DEFAULT));
text.setText(
"
神一樣的人啊!
"
);
shell.pack();
shell.open();
new
KeyThread(display).start();
//
鍵盤響應(yīng)
//
new MouseThread(display).start();
//
鼠標(biāo)響應(yīng)
while
(
!
shell.isDisposed())
{
if
(
!
display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
class
MouseThread
extends
Thread
{
Display display;
int
h;
public
MouseThread(Display display)
{
this
.display
=
display;
h
=
display.getPrimaryMonitor().getBounds().height;
}
public
void
run()
{
Event event
=
new
Event();
//
移動鼠標(biāo)
event.type
=
SWT.MouseMove;
event.x
=
5
;
event.y
=
h
-
5
;
display.post(event);
try
{
Thread.sleep(
100
);
}
catch
(InterruptedException e)
{
}
//
按下右鍵
event.type
=
SWT.MouseDown;
event.button
=
1
;
display.post(event);
try
{
Thread.sleep(
100
);
}
catch
(InterruptedException e)
{
}
//
恢復(fù)
event.type
=
SWT.MouseUp;
display.post(event);
}
}
class
KeyThread
extends
Thread
{
Display display;
int
h;
public
KeyThread(Display display)
{
this
.display
=
display;
h
=
display.getPrimaryMonitor().getBounds().height;
}
public
void
run()
{
Event event
=
new
Event();
//
按下CTRL
event.type
=
SWT.KeyDown;
event.keyCode
=
SWT.CTRL;
display.post(event);
try
{
Thread.sleep(
100
);
}
catch
(InterruptedException e)
{
}
//
按下ESC
event.type
=
SWT.KeyDown;
event.keyCode
=
SWT.ESC;
display.post(event);
try
{
Thread.sleep(
100
);
}
catch
(InterruptedException e)
{
}
//
恢復(fù)
event.type
=
SWT.KeyUp;
event.keyCode
=
SWT.CTRL;
display.post(event);
try
{
Thread.sleep(
100
);
}
catch
(InterruptedException e)
{
}
event.type
=
SWT.KeyUp;
event.keyCode
=
SWT.ESC;
display.post(event);
}
}
posted on 2009-06-02 00:15
俊星
閱讀(820)
評論(0)
編輯
收藏
新用戶注冊
刷新評論列表
只有注冊用戶
登錄
后才能發(fā)表評論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
Powered by:
BlogJava
Copyright © 俊星
主站蜘蛛池模板:
亚洲视频一区二区在线观看
|
香蕉视频免费在线播放
|
久久久久亚洲精品无码网址色欲
|
中文字幕不卡免费视频
|
成人免费无码大片a毛片
|
在线亚洲97se亚洲综合在线
|
国产成人亚洲综合一区
|
无码少妇精品一区二区免费动态
|
亚洲成AV人在线观看网址
|
亚洲人精品亚洲人成在线
|
九月婷婷亚洲综合在线
|
午夜亚洲国产理论片二级港台二级
|
亚洲一区二区高清
|
yellow视频免费看
|
一本久久综合亚洲鲁鲁五月天
|
一级午夜a毛片免费视频
|
久久青青草原亚洲av无码app
|
最新国产乱人伦偷精品免费网站
|
亚洲AV无码一区二三区
|
最近中文字幕电影大全免费版
|
99精品视频在线观看免费
|
亚洲日韩av无码
|
91福利免费网站在线观看
|
亚洲色无码国产精品网站可下载
|
最近的中文字幕大全免费版
|
a视频在线观看免费
|
国产亚洲精彩视频
|
亚洲伊人久久成综合人影院
|
91在线品视觉盛宴免费
|
亚洲1234区乱码
|
99在线视频免费观看视频
|
日韩a级无码免费视频
|
国产亚洲欧美在线观看
|
免费一级一片一毛片
|
日本一区二区三区在线视频观看免费
|
国产精品免费大片
|
亚洲首页在线观看
|
亚洲日韩aⅴ在线视频
|
日韩亚洲精品福利
|
精品久久久久久久免费人妻
|
羞羞视频免费网站入口
|