Class SwingUtils

java.lang.Object
com.compomics.util.gui.utils.SwingUtils

public class SwingUtils
extends Object
Swing utilities methods. Based on code from: http://www.aurelienribon.com/blog/2012/07/tutorial-beautifying-the-dialogs-in-swing-applications/
Author:
Harald Barsnes
  • Constructor Summary

    Constructors 
    Constructor Description
    SwingUtils()
    Empty default constructor
  • Method Summary

    Modifier and Type Method Description
    static void fadeIn​(JDialog dialog)
    Creates an animation to fade the dialog opacity from 0 to 1.
    static void fadeIn​(JDialog dialog, int delay, float incrementSize)
    Creates an animation to fade the dialog opacity from 0 to 1.
    static void fadeInAndOut​(JDialog dialog)
    Creates an animation to fade the dialog opacity from 0 to 1, wait at 1 and then fade to 0.
    static void fadeInAndOut​(JDialog dialog, int delay, float incrementSize, int displayTime)
    Creates an animation to fade the dialog opacity from 0 to 1, wait at 1 and then fade to 0 and dispose.
    static void fadeOut​(JDialog dialog)
    Creates an animation to fade the dialog opacity from 1 to 0.
    static void fadeOut​(JDialog dialog, int delay, float incrementSize)
    Creates an animation to fade the dialog opacity from 1 to 0, and then dispose.

    Methods inherited from class java.lang.Object

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

    • SwingUtils

      public SwingUtils()
      Empty default constructor
  • Method Details

    • fadeIn

      public static void fadeIn​(JDialog dialog)
      Creates an animation to fade the dialog opacity from 0 to 1. Using a default delay of 5 ms and an increment size of 0.05.
      Parameters:
      dialog - the dialog to fade in
    • fadeIn

      public static void fadeIn​(JDialog dialog, int delay, float incrementSize)
      Creates an animation to fade the dialog opacity from 0 to 1.
      Parameters:
      dialog - the dialog to fade in
      delay - the delay in ms before starting and between each change
      incrementSize - the increment size
    • fadeOut

      public static void fadeOut​(JDialog dialog)
      Creates an animation to fade the dialog opacity from 1 to 0. Using a default delay of 5 ms and an increment size of 0.05.
      Parameters:
      dialog - the dialog to fade out
    • fadeOut

      public static void fadeOut​(JDialog dialog, int delay, float incrementSize)
      Creates an animation to fade the dialog opacity from 1 to 0, and then dispose.
      Parameters:
      dialog - the dialog to fade out
      delay - the delay in ms before starting and between each change
      incrementSize - the increment size
    • fadeInAndOut

      public static void fadeInAndOut​(JDialog dialog)
      Creates an animation to fade the dialog opacity from 0 to 1, wait at 1 and then fade to 0. Default initial time of 50 ms, increment size of 0.05 and display time of 10000 ms.
      Parameters:
      dialog - the dialog to display
    • fadeInAndOut

      public static void fadeInAndOut​(JDialog dialog, int delay, float incrementSize, int displayTime)
      Creates an animation to fade the dialog opacity from 0 to 1, wait at 1 and then fade to 0 and dispose.
      Parameters:
      dialog - the dialog to display
      delay - the delay in ms before starting and between each change
      incrementSize - the increment size
      displayTime - the time in ms the dialog is fully visible