Class OverlayableUtils

java.lang.Object
com.jidesoft.swing.OverlayableUtils

public class OverlayableUtils extends Object
This util class has several methods related to Overlayable.
  • Constructor Details

    • OverlayableUtils

      public OverlayableUtils()
  • Method Details

    • getOverlayable

      public static Overlayable getOverlayable(JComponent component)
      Gets the overlayable associated with this component and its parents. This method will find the first overlayable that contains the component or its parents.
      Parameters:
      component - the component.
      Returns:
      the overlayable.
    • getAllOverlayables

      public static Overlayable[] getAllOverlayables(JComponent component)
      Gets all overlayables associated with this component and its parents. Different from getOverlayable(javax.swing.JComponent), this method will find the all overlayables that contain the component or its parents.
      Parameters:
      component - the component
      Returns:
      all the overlayables.
    • repaintOverlayable

      public static void repaintOverlayable(JComponent component)
      Repaints the overlayable component associated with component. Because the overlay component is shown above the component and its child components, if any of the components repaint, the overlay component will be covered if the overlay component doesn't know to repaint immediately. Due to way Swing repaintManager works, there isn't any other better way to solve the issue other than the component has code to trigger the repaint of the overlay component. That's one reason we provide this way to repaint the overlay component easily.

      See below for an example of how to prepare the component to be ready for the overlayable.

      
       public OverlayTextField() {
       ...
       public void repaint(long tm, int x, int y, int width, int height) {
           super.repaint(tm, x, y, width, height);
           OverlayableUtils.repaintOverlayable(this);
       }
       
      Parameters:
      component - the component that has an overlayable.
    • repaintAllOverlayables

      public static void repaintAllOverlayables(JComponent component)
      Repaints all the overlayables associated with the component or its parents.
      Parameters:
      component - the component.
    • getPredefinedOverlayIcon

      public static Icon getPredefinedOverlayIcon(String name)
      Gets the predefined icon that can be used as the overlay icon for the Swing component. Available icon names are
      Parameters:
      name - name defined in OverlayableIconsFactory.
      Returns:
      the icon