Package furbelow

Class ListAnimator


public abstract class ListAnimator extends AbstractComponentDecorator
Animates moving list cells out of the way for a potential drop. This decorator completely over-paints the target JList, optionally painting a dragged item and animating creation of a space for the dragged item to be dropped. Thanks to Neil Cochran/keilly for a base visualization: http://jroller.com/page/swinguistuff?entry=animated_jlist
  • Constructor Details

    • ListAnimator

      public ListAnimator(JList list)
  • Method Details

    • getPlaceholder

      protected Object getPlaceholder()
    • move

      protected abstract void move(int fromIndex, int toIndex)
    • drop

      protected void drop(Transferable t, int index)
    • startDragOver

      public void startDragOver(Point where)
      Track a drag which originated somewhere else.
    • endDragOver

      public void endDragOver(Point where, Transferable t)
      Stop tracking an external drag.
    • startDrag

      public void startDrag(Point where)
      Start an internal drag.
    • endDrag

      public void endDrag(Point where)
      End an internal drag.
    • setInsertionLocation

      public void setInsertionLocation(Point where)
    • setInsertionIndex

      public void setInsertionIndex(int idx)
    • paint

      public void paint(Graphics g)
      Description copied from class: AbstractComponentDecorator
      Define the decoration's appearance. The point (0,0) represents the upper left corner of the decorated component. The default clip mask will be the extents of the decoration bounds, as indicated by AbstractComponentDecorator.getDecorationBounds(), which defaults to the decorated component bounds.
      Specified by:
      paint in class AbstractComponentDecorator
    • main

      public static void main(String[] args)
      Throw up a frame to demonstrate the animator at work. Funkify the list renderer to demonstrate that customized renderers are handled properly.