public TreeMenu(){
        super();
        menu = new JPopupMenu();
        menu.setLightWeightPopupEnabled(false);
        
        addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                grabFocus();
                
            }
        });
        
	MouseAdapter ma = new MouseAdapter() {
		private void myPopupEvent(MouseEvent e) {
			int x = e.getX();
			int y = e.getY();
			JTree tree = (JTree)e.getSource();
			TreePath path = tree.getPathForLocation(x, y);
			if (path != null){
                            tree.setSelectionPath(path);
                        }
			//	return;	

			

			//Object obj = path.getLastPathComponent();

			//String label = "popup: " + obj.getTreeLabel();
			checkEnabledMenuAction();
			menu.show(tree, x, y);
		}
		public void mousePressed(MouseEvent e) {
			if (e.isPopupTrigger()) myPopupEvent(e);
		}
		public void mouseReleased(MouseEvent e) {
			if (e.isPopupTrigger()) myPopupEvent(e);
		}
	};

	addMouseListener(ma);
        
        createMenu();
        createMenuShortcut();
    }