SWT 選單加快捷方式

2021-06-16 07:04:23 字數 1067 閱讀 9458

隨便寫一下,方便以後檢視

1.選單欄中的快捷方式

2,使用setaccelerator(int acc)方法建立

display display = new display();

shell shell = new shell(display);

shell.settext("gantt chart - group example");

shell.setsize(600, 500);

shell.setlayout(new filllayout());

// menu

menu menu = new menu(shell, swt.bar);

shell.setmenubar(menu);

//1種,通過alt+y呼叫

menuitem item = new menuitem(menu, swt.cascade);

item.settext("mainitem(&y)");

menu dropmenu = new menu(shell, swt.drop_down);

item.setmenu(dropmenu);

menuitem subitem = new menuitem(dropmenu, swt.border);

//2種通過 ctrl+shift+f

subitem.settext("sub(&n) ctrl+shift+f");

subitem.setaccelerator(swt.ctrl + swt.shift + 'f');

//1種,通過o,此處你設定什麼就能用什麼呼叫,如果設定為小寫o,訪問用o,不用加alt

"sub(&o)");

subitem.addselectionlistener(new selectionlistener()

@override

public void widgetdefaultselected(selectionevent e)

});

ubuntu gnome 桌面增加快捷方式

desktop entry version 1.0 name pycharm icon opt pycharm 2020.1 bin pycharm.png exec opt pycharm 2020.1 bin pycharm.sh f comment pycharm categories dev...

用VB指令碼實現向右鍵選單新增快捷方式

this is file extension the command should generate filetype vbs connect to wscript.shell registry access set wshshell createobject wscript.shell read ...

Ubuntu Unity 新增快捷方式至側邊欄

but in ubuntu 11.10 you must install menu classic indicator before use it sudo apt add repository ppa diesch testing sudo apt get update sudo apt get ...