本文整理汇总了Java中org.eclipse.swt.widgets.MenuItem.setMenu方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.setMenu方法的具体用法?Java MenuItem.setMenu怎么用?Java MenuItem.setMenu使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.widgets.MenuItem
的用法示例。
在下文中一共展示了MenuItem.setMenu方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createViewMenu
import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
private Menu createViewMenu() {
final MenuItem mi = new MenuItem(menuBar, SWT.CASCADE);
mi.setText("&View");
final Menu m = new Menu(shell, SWT.DROP_DOWN);
mi.setMenu(m);
SWTUtils.addMenuItem(m, "Increase Font Size", SWT.CTRL + '+', () -> {
setFontSize(fontSize + 1);
});
SWTUtils.addMenuItem(m, "Decrease Font Size", SWT.CTRL + '-', () -> {
setFontSize(fontSize - 1);
});
return m;
}
示例2: createAlbaumMenu
import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
private Menu createAlbaumMenu() {
final MenuItem mi = new MenuItem(menuBar, SWT.CASCADE);
mi.setText("&Albaum");
final Menu m = new Menu(shell, SWT.DROP_DOWN);
mi.setMenu(m);
SWTUtils.addMenuItem(m, "E&xit", SWT.SHIFT + SWT.CTRL + 'X', () -> {
isExiting = true;
});
return m;
}
示例3: setMenu
import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
public static void setMenu(final MenuItem menuItem, final Menu subMenu)
{
if (Thread.currentThread() != getDisplay().getThread())
{
getDisplay().syncExec(new Runnable() {public void run() {setMenu(menuItem, subMenu);}});
}
else
{
menuItem.setMenu(subMenu);
}
}
示例4: createContents
import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
/**
* Create contents of the window.
*/
protected void createContents() {
shlContacts = new Shell();
shlContacts.setSize(200, 400);
shlContacts.setText("Contacts");
Menu menu = new Menu(shlContacts, SWT.BAR);
shlContacts.setMenuBar(menu);
MenuItem mntmControl = new MenuItem(menu, SWT.CASCADE);
mntmControl.setText("dev_options");
Menu menu_1 = new Menu(mntmControl);
mntmControl.setMenu(menu_1);
MenuItem mntmdevrescan = new MenuItem(menu_1, SWT.NONE);
mntmdevrescan.setText("(dev)_rescan");
table = new Table(shlContacts, SWT.BORDER | SWT.FULL_SELECTION);
table.setBounds(0, 0, 194, 298);
table.setHeaderVisible(true);
table.setLinesVisible(true);
TableColumn tblclmnAvailableContacts = new TableColumn(table, SWT.NONE);
tblclmnAvailableContacts.setResizable(false);
tblclmnAvailableContacts.setWidth(100);
tblclmnAvailableContacts.setText("Available Contacts:");
Button btnConnect = new Button(shlContacts, SWT.NONE);
btnConnect.setBounds(10, 309, 174, 27);
btnConnect.setText("CONNECT");
}
示例5: createCascadeMenu
import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
CascadeMenu createCascadeMenu(Menu parent, Image img, String txt) {
MenuItem mi = createItem(parent, SWT.CASCADE, img, txt);
Menu m = new Menu(mi);
mi.setMenu(m);
return new CascadeMenu(m, mi);
}
示例6: createSubMenu
import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
Menu createSubMenu(Menu parentMenu, String text) {
MenuItem mi = new MenuItem(menu, SWT.CASCADE);
mi.setText(text);
Menu m = new Menu(parentMenu);
mi.setMenu(m);
return m;
}
示例7: viewMenu
import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
private void viewMenu() {
MenuItem view = new MenuItem(shell.getMenuBar() == null ? Display.getDefault().getMenuBar() : shell.getMenuBar(), SWT.CASCADE);
view.setText("&View");
Menu viewmenu = new Menu(shell, SWT.DROP_DOWN);
view.setMenu(viewmenu);
addItem(viewmenu, engine, 'E');
if(push != null)
addItem(viewmenu, push, 'D');
addItem(viewmenu, resman, 'R');
}
示例8: MenuClass
import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
public MenuClass() {
display = new Display();
shell = new Shell(display);
shell.setText("Menu Example");
shell.setSize(300, 200);
text = new Text(shell, SWT.BORDER);
text.setBounds(80, 50, 150, 25);
menuBar = new Menu(shell, SWT.BAR);
fileMenuHeader = new MenuItem(menuBar, SWT.CASCADE);
fileMenuHeader.setText("&File");
fileMenu = new Menu(shell, SWT.DROP_DOWN);
fileMenuHeader.setMenu(fileMenu);
fileSaveItem = new MenuItem(fileMenu, SWT.PUSH);
fileSaveItem.setText("&Save");
fileEnglishItem = new MenuItem(fileMenu, SWT.RADIO);
fileEnglishItem.setText("English");
fileGermanItem = new MenuItem(fileMenu, SWT.RADIO);
fileGermanItem.setText("German");
fileExitItem = new MenuItem(fileMenu, SWT.PUSH);
fileExitItem.setText("E&xit");
editMenuHeader = new MenuItem(menuBar, SWT.CASCADE);
editMenuHeader.setText("&Edit");
editMenu = new Menu(shell, SWT.DROP_DOWN);
editMenuHeader.setMenu(editMenu);
editCopyItem = new MenuItem(editMenu, SWT.PUSH);
editCopyItem.setText("&Copy");
fileExitItem.addSelectionListener(new MenuItemListener());
fileSaveItem.addSelectionListener(new MenuItemListener());
editCopyItem.addSelectionListener(new MenuItemListener());
fileEnglishItem.addSelectionListener(new RadioItemListener());
fileGermanItem.addSelectionListener(new RadioItemListener());
shell.setMenuBar(menuBar);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}