popupactionmenuitem.java

来自「java 调用windows的api」· Java 代码 · 共 46 行

JAVA
46
字号
package org.jawin.browser.popup;

import javax.swing.JMenuItem;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.jawin.browser.tree.TypeDataTree;

/**
 * A JMenuItem that knows how to display and handle PopupAction
 * instances.
 *
 * <p>Title: Jawin Code Generation GUI</p>
 * <p>Description: GUI for exploring type libraries and generating Java code</p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: Open Source Incentive</p>
 *
 * @author Josh Passenger
 * @version 1.0
 */

public class PopupActionMenuItem extends JMenuItem
{
	private PopupAction popupAction = null;

	public PopupActionMenuItem(PopupAction newPopupAction)
	{
		popupAction = newPopupAction;
		setText(popupAction.getDisplay());
		registerListeners();
	}

	/**
	 * Register a listeners so that when this menu item is clicked,
	 * the popupAction fires
	 */
	private void registerListeners()
	{
		addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				popupAction.performAction(PopupManager.getInstance().getSelectedBaseData());
			};
		});
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?