parentpopupmenu.java

来自「导出ORACLE数据库对象DDL语句的程序」· Java 代码 · 共 82 行

JAVA
82
字号
package com.icbcsdc.ddlexp.ui.popMenu;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;

import com.icbcsdc.ddlexp.pub.xml.nodeinfo.XMLNode;
import com.icbcsdc.ddlexp.ui.TreeFrame;

/**
 * @author zhangyc
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
public class ParentPopupMenu extends PopupMenu {
	JMenuItem expDDLItem =null; 
	JMenuItem refreshItem =null; 
	JPopupMenu popup = new JPopupMenu();
	TreeFrame parent=null;

	/**
	 * Constructor for ParentPopupMenu.
	 * @param node
	 */
	public ParentPopupMenu(TreeFrame parent,XMLNode node) {
		super(node);
		this.parent=parent;
	}

	protected void init(){
		expDDLItem=new JMenuItem("Export "+this.node.getName());
		refreshItem=new JMenuItem("Refresh "+this.node.getName());

		expDDLItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				expDDL();
			}
		});

		refreshItem.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				refreshNode();
			}
		});
		
		popup.add(expDDLItem);
		popup.add(refreshItem);
	}

	/**
	 * @see com.icbcsdc.ddlexp.ui.popMenu.PopupMenu#getJPopupMenu()
	 */
	public JPopupMenu getJPopupMenu() {
		init();
		return popup;
	}
	
	public void expDDL(){
		parent.getSelectedTree().selectedNodeExport();
	}
	
	public void refreshNode(){
		parent.getSelectedTree().selectedNodeRefresh();		

	}

	/**
	 * Returns the parent.
	 * @return TreeFrame
	 */
	public TreeFrame getTreeFrame() {
		return parent;
	}
	public static void main(String[] args) {
	}
}

⌨️ 快捷键说明

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