kooyee ‘s blog
開源軟件, 眾人努力的結(jié)晶, 全人類的共同財(cái)富
posts - 103, comments - 55, trackbacks - 0, articles - 66
::
首頁
::
新隨筆
::
聯(lián)系
::
聚合
::
管理
[SWT] swt中右鍵菜單
Posted on 2007-07-20 21:24
kooyee
閱讀(1821)
評(píng)論(0)
編輯
收藏
所屬分類:
GUI骨衣
加入右鍵菜單到CTabFolder中的item, 同理其他的control也可以加入右鍵菜單。
public
static
void
main(String[] args)
...
{
final
Display display
=
new
Display();
Shell shell
=
new
Shell(display);
shell.setLayout(
new
FillLayout());
final
CTabFolder f
=
new
CTabFolder(shell, SWT.BORDER);
for
(
int
i
=
0
; i
<
10
; i
++
)
...
{
CTabItem item
=
new
CTabItem(f, SWT.NONE);
item.setText(
"
item
"
+
i);
}
final
Menu menu
=
new
Menu (shell, SWT.POP_UP);
final
MenuItem menuItem
=
new
MenuItem (menu, SWT.PUSH);
f.setMenu(menu);
menu.addMenuListener(
new
MenuAdapter()
...
{
public
void
menuShown(MenuEvent e)
...
{
Point p
=
display.getCursorLocation();
p
=
f.toControl(p);
CTabItem item
=
f.getItem(p);
if
(item
==
null
)
...
{
menu.setVisible(
false
);
return
;
}
menuItem.setText(
"
action for
"
+
item.getText());
}
}
);
shell.setSize(
800
,
600
);
shell.open();
while
(
!
shell.isDisposed())
...
{
if
(
!
display.readAndDispatch())
display.sleep();
}
display.dispose();
}
新用戶注冊(cè)
刷新評(píng)論列表
只有注冊(cè)用戶
登錄
后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
相關(guān)文章:
[SWT] swt中的常數(shù)
[SWT] Text 文本框
[SWT] Canvas scroll 滾動(dòng)條
[SWT] Print & Print Preview
[SWT] Shell窗口操作
[SWT] SWT 讓耗時(shí)的操作后臺(tái)運(yùn)行
[SWT] checkbox等控件設(shè)置為只讀
[SWT] swt中右鍵菜單
[SWT] swt tray demo:右鍵菜單,單擊隱藏,所有事件的例子
[SWT] SWT table中select item以及添加其他control(checkbox, button)
Powered by:
BlogJava
Copyright © kooyee
日歷
<
2025年7月
>
日
一
二
三
四
五
六
29
30
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
31
1
2
3
4
5
6
7
8
9
公告
一起暢游計(jì)算機(jī)的世界
常用鏈接
我的隨筆
我的文章
我的評(píng)論
我的參與
最新評(píng)論
留言簿
(7)
給我留言
查看公開留言
查看私人留言
隨筆分類
AI 人工智能(1)
Ajax學(xué)習(xí)手記(2)
C/C++(1)
Database數(shù)據(jù)庫技術(shù)(4)
Groovy on Grails(1)
GUI骨衣 (6)
J2EE(1)
Jasper Report (2)
Java (15)
Lniux/Unix (14)
Regular Expression正則表達(dá)式
Software(1)
Software Engineering 軟件工程(2)
Swing/Applet(19)
Web Design網(wǎng)頁設(shè)計(jì) (4)
Web Framework 網(wǎng)絡(luò)框架(1)
Windows (2)
Wireless Ad-hoc and sensor network(4)
開源 OpenSource(1)
隨筆檔案
2009年1月 (1)
2008年12月 (3)
2008年11月 (3)
2008年10月 (2)
2008年7月 (2)
2008年6月 (22)
2008年5月 (3)
2008年4月 (2)
2008年3月 (10)
2008年2月 (14)
2008年1月 (5)
2007年12月 (6)
2007年11月 (5)
2007年10月 (5)
2007年9月 (2)
2007年8月 (17)
搜索
積分與排名
積分 - 163752
排名 - 363
最新評(píng)論
1.?re: SUM, COUNT 等在 jasper report 中使用方法
<javascript language="java"> alert("aaaa")</javascript>
--sd
2.?re: 【Bug】當(dāng)調(diào)用nam時(shí)錯(cuò)誤
怎么重裝ns-2.33
--雨中蝶
3.?re: [SWT] SWT table中select item以及添加其他control(checkbox, button)
如果要加的CheckBox很多的話,會(huì)不會(huì)速度很慢呢?
--問路
4.?re: [JAVA] 使用xsl來動(dòng)態(tài)生成java代碼
評(píng)論內(nèi)容較長,點(diǎn)擊標(biāo)題查看
--cosplay
5.?re: 『Java』java.lang.UnsupportedOperationException at java.util.AbstractLis
api 的設(shè)計(jì)多此一舉還搞個(gè)內(nèi)部類
--冬天雞雞好冷
閱讀排行榜
1.? VB使用WebBrowser讀取網(wǎng)頁內(nèi)容(12252)
2.?【Simulator】Cygwin下NS2安裝和配置(3662)
3.?什么是*.ps文件(3603)
4.?『Java』java.lang.UnsupportedOperationException at java.util.AbstractLis(3555)
5.?【linux腳本】bad interpreter: No such file or directory(3386)
主站蜘蛛池模板:
通道
|
南溪县
|
达州市
|
陵川县
|
榆林市
|
永新县
|
高雄市
|
平泉县
|
汕头市
|
德令哈市
|
丰台区
|
乌兰县
|
蒙城县
|
老河口市
|
四平市
|
峡江县
|
嘉鱼县
|
改则县
|
绥中县
|
仙桃市
|
余姚市
|
本溪
|
新乐市
|
视频
|
兴宁市
|
宁都县
|
神木县
|
宝应县
|
洪雅县
|
介休市
|
呼图壁县
|
黄梅县
|
弥渡县
|
武安市
|
沐川县
|
苗栗县
|
香格里拉县
|
海伦市
|
西平县
|
兴山县
|
新乡市
|