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


Java MenuListener类代码示例

本文整理汇总了Java中org.eclipse.swt.events.MenuListener的典型用法代码示例。如果您正苦于以下问题:Java MenuListener类的具体用法?Java MenuListener怎么用?Java MenuListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: addMenuListener

import org.eclipse.swt.events.MenuListener; //导入依赖的package包/类
/**
 * Adds the listener to the collection of listeners who will be notified
 * when menus are hidden or shown, by sending it one of the messages defined
 * in the <code>MenuListener</code> interface.
 * 
 * @param listener
 *            the listener which should be notified
 * 
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @see MenuListener
 * @see #removeMenuListener
 */
public void addMenuListener(MenuListener listener) {
	checkWidget();
	if (listener == null)
		error(SWT.ERROR_NULL_ARGUMENT);
	TypedListener typedListener = new TypedListener(listener);
	addListener(SWT.Hide, typedListener);
	addListener(SWT.Show, typedListener);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:32,代码来源:Menu.java

示例2: removeMenuListener

import org.eclipse.swt.events.MenuListener; //导入依赖的package包/类
/**
 * Removes the listener from the collection of listeners who will be
 * notified when the menu events are generated for the control.
 * 
 * @param listener
 *            the listener which should no longer be notified
 * 
 * @exception IllegalArgumentException
 *                <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
 *                </ul>
 * @exception SWTException
 *                <ul>
 *                <li>ERROR_WIDGET_DISPOSED - if the receiver has been
 *                disposed</li>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the receiver</li>
 *                </ul>
 * 
 * @see MenuListener
 * @see #addMenuListener
 */
public void removeMenuListener(MenuListener listener) {
	checkWidget();
	if (listener == null)
		error(SWT.ERROR_NULL_ARGUMENT);
	if (eventTable == null)
		return;
	eventTable.unhook(SWT.Hide, listener);
	eventTable.unhook(SWT.Show, listener);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:32,代码来源:Menu.java


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