当前位置: 首页>>代码示例>>Java>>正文


Java MenuItem.setAccelerator方法代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.MenuItem.setAccelerator方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.setAccelerator方法的具体用法?Java MenuItem.setAccelerator怎么用?Java MenuItem.setAccelerator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.widgets.MenuItem的用法示例。


在下文中一共展示了MenuItem.setAccelerator方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createMenuItem

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
private void createMenuItem(Menu menu, BookmarkId selectedBookmarkId, BookmarkNumber bookmarkNumber) {
	Optional<BookmarkId> bookmarkId = numberedBookmarks.getBookmark(bookmarkNumber);
	final MenuItem menuItem = new MenuItem(menu, SWT.RADIO);
	menuItem.setSelection(bookmarkId.isPresent() ? bookmarkId.get().equals(selectedBookmarkId) : false);
	menuItem.setText(getText(bookmarkId));
	menuItem.setAccelerator('0' + bookmarkNumber.getNumber());
	Image image = getImage(bookmarkNumber, bookmarkId);
	if (image != null) {
		menuItem.setImage(image);
	}
	Listener listener = new Listener() {
		@Override
		public void handleEvent(Event event) {
			switch (event.type) {
			case SWT.Selection:
				if (menuItem.getSelection()) {
					bookmarksService.addNumberedBookmark(selectedBookmarkId, bookmarkNumber);
				}
				break;
			}
		}
	};
	menuItem.addListener(SWT.Selection, listener);
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:25,代码来源:SetNumberForBookmarkMenu.java

示例2: addMenuItem

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
private MenuItem addMenuItem(Menu menu, String text, int accelerator,
		Object data, SelectionListener listener) {
	MenuItem item = new MenuItem(menu, SWT.NONE);
	item.setText(text);
	item.addSelectionListener(listener);
	if (accelerator != SWT.NONE)
		item.setAccelerator(accelerator);
	item.setData(data);
	return item;
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:11,代码来源:BarManager.java

示例3: addMenuItem

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
private MenuItem addMenuItem(Menu menu, String text, int accelerator,
		SelectionListener listener) {
	MenuItem item = addMenuItem(menu, text, listener);
	if (accelerator != SWT.NONE)
		item.setAccelerator(accelerator);
	return item;
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:8,代码来源:MenuManager.java

示例4: updateAccelerator

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
private void updateAccelerator(MenuItem item, String itemText,
		char newAccelerator) {
	itemText += " \t Ctrl+"
			+ (newAccelerator == ' ' ? "[space]" : newAccelerator);
	int acc = SWT.MOD1
			+ (newAccelerator == ' ' ? SWT.SPACE : newAccelerator);
	item.setText(itemText);
	item.setAccelerator(acc);
}
 
开发者ID:juanerasmoe,项目名称:pmTrans,代码行数:10,代码来源:MenuManager.java

示例5: setAccelerator

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
/**
 * Helper method to set a keyboard accelerator for a MenuItem. If kbInfo is SWT.NONE, no accelerator will be set.
 * @param menu SWT MenuItem
 * @param kbInfo KeyBindingInfo object, which contains the SWT accelerator value and its display name
 */
private static void setAccelerator(final MenuItem menu, final KeyBindingInfo kbInfo)
{
	if ( menu.isDisposed()){
		return;
	}
    if(kbInfo.accelerator != SWT.NONE)
    {
        menu.setAccelerator(kbInfo.accelerator);

        // SWT on OS X now uses native drawing
        if(!Constants.isOSX && !menu.getText().endsWith(kbInfo.name))
            menu.setText(menu.getText() + kbInfo.name);
    }
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:20,代码来源:KeyBindings.java

示例6: addItem

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
private void addItem(Menu viewmenu, TabPanel tab, char accel) {
	MenuItem engineItem = new MenuItem(viewmenu, SWT.PUSH);
	engineItem.setText("&"+tab.getLabel()+"\tCTRL+"+accel);
	engineItem.setAccelerator(SWT.CTRL + accel);
	engineItem.addSelectionListener(tab);
}
 
开发者ID:arisona,项目名称:ether,代码行数:7,代码来源:Soundium.java

示例7: ContextMenu

import org.eclipse.swt.widgets.MenuItem; //导入方法依赖的package包/类
public ContextMenu(final EarthquakeBulletinGui gui) {
	final Table table = ResultsTable.this.getTableViewer().getTable();
	menu = new Menu(table);

	// Show map...
	showMapMenuItem = new MenuItem(menu, SWT.PUSH);
	showMapMenuItem.setText(Messages.get(LBL_MENU_ITEM_SHOW_MAP));
	showMapMenuItem.addListener(SWT.Selection, new ShowMapListener(gui));
	menu.setDefaultItem(showMapMenuItem);

	new MenuItem(menu, SWT.SEPARATOR);

	// Open in browser...
	openBrowserMenuItem = new MenuItem(menu, SWT.PUSH);
	openBrowserMenuItem.setText(Messages.get(LBL_MENU_ITEM_OPEN_BROWSER));
	openBrowserMenuItem.addSelectionListener(new OpenInBrowserSelectionListener(gui));

	// Copy link...
	copyLinkMenuItem = new MenuItem(menu, SWT.PUSH);
	copyLinkMenuItem.setText(Messages.get(LBL_MENU_ITEM_COPY_LINK));
	copyLinkMenuItem.addSelectionListener(new CopyLinkSelectionListener(gui));

	new MenuItem(menu, SWT.SEPARATOR);

	// Google Maps Popup...
	googleMapsPopupMenuItem = new MenuItem(menu, SWT.PUSH);
	googleMapsPopupMenuItem.setText(Messages.get(LBL_MENU_ITEM_GOOGLE_MAPS_POPUP));
	googleMapsPopupMenuItem.addSelectionListener(new GoogleMapsPopupSelectionListener(gui));

	// Google Maps in browser...
	googleMapsBrowserMenuItem = new MenuItem(menu, SWT.PUSH);
	googleMapsBrowserMenuItem.setText(Messages.get(LBL_MENU_ITEM_GOOGLE_MAPS_BROWSER));
	googleMapsBrowserMenuItem.addSelectionListener(new GoogleMapsBrowserSelectionListener(gui));

	new MenuItem(menu, SWT.SEPARATOR);

	exportCsvMenuItem = new MenuItem(menu, SWT.PUSH);
	exportCsvMenuItem.setText(Messages.get(LBL_MENU_ITEM_EXPORT_CSV) + SwtUtils.getMod1ShortcutLabel(SwtUtils.KEY_SAVE));
	exportCsvMenuItem.addSelectionListener(new ExportCsvSelectionListener(gui));
	exportCsvMenuItem.setAccelerator(SWT.MOD1 | SwtUtils.KEY_SAVE);

	table.addMenuDetectListener(new ResultsTableContextMenuDetectListener(ResultsTable.this));
}
 
开发者ID:Albertus82,项目名称:EarthquakeBulletin,代码行数:44,代码来源:ResultsTable.java


注:本文中的org.eclipse.swt.widgets.MenuItem.setAccelerator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。