Class VFSDirectoryEntryTable.ColumnDragHook

  • All Implemented Interfaces:
    java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.util.EventListener, javax.swing.event.MouseInputListener
    Enclosing class:
    VFSDirectoryEntryTable

    public static class VFSDirectoryEntryTable.ColumnDragHook
    extends java.lang.Object
    implements javax.swing.event.MouseInputListener
    Original code: https://stackoverflow.com/questions/1155137/how-to-keep-a-single-column-from-being-reordered-in-a-jtable/14480948 A delegating MouseInputListener to be installed instead of the one registered by the ui-delegate. It's implemented to prevent dragging the first column or any other column over the first.
    • Constructor Summary

      Constructors 
      Constructor Description
      ColumnDragHook​(javax.swing.table.JTableHeader header)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void installHook()  
      protected void installMouseHook()  
      protected void installMouseMotionHook()  
      void mouseClicked​(java.awt.event.MouseEvent e)  
      void mouseDragged​(java.awt.event.MouseEvent e)
      Implemented to pass the event to the original only if the mouseX doesn't lead to dragging the column over the first.
      void mouseEntered​(java.awt.event.MouseEvent e)  
      void mouseExited​(java.awt.event.MouseEvent e)  
      void mouseMoved​(java.awt.event.MouseEvent e)  
      void mousePressed​(java.awt.event.MouseEvent e)
      Implemented to do some tweaks/bookkeeping before/after passing the event to the original - temporarily disallow reordering if hit on first column - calculate the max mouseX that's allowable in dragging to the left
      void mouseReleased​(java.awt.event.MouseEvent e)  
      void uninstallHook()  
      protected void uninstallMouseHook()  
      protected void uninstallMouseMotionHook()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ColumnDragHook

        public ColumnDragHook​(javax.swing.table.JTableHeader header)
    • Method Detail

      • mousePressed

        public void mousePressed​(java.awt.event.MouseEvent e)
        Implemented to do some tweaks/bookkeeping before/after passing the event to the original - temporarily disallow reordering if hit on first column - calculate the max mouseX that's allowable in dragging to the left
        Specified by:
        mousePressed in interface java.awt.event.MouseListener
      • mouseDragged

        public void mouseDragged​(java.awt.event.MouseEvent e)
        Implemented to pass the event to the original only if the mouseX doesn't lead to dragging the column over the first.
        Specified by:
        mouseDragged in interface java.awt.event.MouseMotionListener
      • mouseReleased

        public void mouseReleased​(java.awt.event.MouseEvent e)
        Specified by:
        mouseReleased in interface java.awt.event.MouseListener
      • mouseClicked

        public void mouseClicked​(java.awt.event.MouseEvent e)
        Specified by:
        mouseClicked in interface java.awt.event.MouseListener
      • mouseEntered

        public void mouseEntered​(java.awt.event.MouseEvent e)
        Specified by:
        mouseEntered in interface java.awt.event.MouseListener
      • mouseExited

        public void mouseExited​(java.awt.event.MouseEvent e)
        Specified by:
        mouseExited in interface java.awt.event.MouseListener
      • mouseMoved

        public void mouseMoved​(java.awt.event.MouseEvent e)
        Specified by:
        mouseMoved in interface java.awt.event.MouseMotionListener
      • installHook

        protected void installHook()
      • installMouseMotionHook

        protected void installMouseMotionHook()
      • installMouseHook

        protected void installMouseHook()
      • uninstallHook

        public void uninstallHook()
      • uninstallMouseMotionHook

        protected void uninstallMouseMotionHook()
      • uninstallMouseHook

        protected void uninstallMouseHook()