Class DirTreePopupMenu

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, MenuElement

public class DirTreePopupMenu extends JPopupMenu
Represents a dynamic right click menu for DirTree. When invoked, it will give you the option to lock the DirTree to the selected directory. If the DirTree is already locked, it will also give you the option to unlock it (revert to file system root directory). We also handle selecting a node on right click here, so a separate MouseListener isn't needed for that.
Since:
2017-11-09
Author:
scorbo2
See Also:
  • Method Details

    • createPopup

      public static DirTreePopupMenu createPopup(DirTree dirTree)
      Creates an empty popup menu and associates it with the given DirTree. No further configuration is required from the calling code.
      Parameters:
      dirTree - The DirTree for which this menu should serve as a popup.
      Returns:
      A DirTreePopupMenu instance.
    • show

      public void show(Component source, int x, int y)
      Invoked automatically to show this popup. The menu will be dynamically constructed based on the DirTree instance associated with this menu.
      Overrides:
      show in class JPopupMenu
      Parameters:
      source - The JTree instance that triggered this popu.
      x - Mouse x location.
      y - Mouse y location.