Java Swing UIManager getAnimationSpeed()

Here you can find the source of getAnimationSpeed()

Description

Returns the length of time GUI animations take, in milliseconds.

License

BSD License

Exception

Parameter Description
Exception If an error occurs.

Return

The length of time, in milliseconds.

Declaration

public static long getAnimationSpeed() throws Exception 

Method Source Code

//package com.java2s;
/*//  ww w  .java2  s.  c  om
 * 11/11/2010
 *
 * SubstanceUtils.java - Utility methods for Java 1.4-compatible applications
 * looking to support Substance 6.1 if the current JRE is 1.6+.
 * Copyright (C) 2003 Robert Futrell
 * http://fifesoft.com/rtext
 * Licensed under a modified BSD license.
 * See the included license file for details.
 */

import java.lang.reflect.Method;

import javax.swing.UIManager;

public class Main {
    private static final String LAFWIDGET_PKG = "org.pushingpixels.lafwidget.";

    /**
     * Returns the length of time GUI animations take, in milliseconds.
     *
     * @return The length of time, in milliseconds.
     * @throws Exception If an error occurs.
     * @see #setAnimationSpeed(long)
     */
    public static long getAnimationSpeed() throws Exception {

        long speed = -1;

        ClassLoader cl = (ClassLoader) UIManager.get("ClassLoader");
        if (cl != null) {
            String managerClassName = LAFWIDGET_PKG + "animation.AnimationConfigurationManager";
            Class<?> managerClazz = Class.forName(managerClassName, true, cl);
            Method m = managerClazz.getMethod("getInstance");
            Object manager = m.invoke(null);
            m = managerClazz.getMethod("getTimelineDuration");
            Long millis = (Long) m.invoke(manager);
            speed = millis.longValue();
        }

        return speed;

    }
}

Related

  1. disabledIcon(JComponent parent, Icon icon)
  2. disablePaintSliderValue()
  3. drawVistaBackground(Graphics g, Component b, String prefix)
  4. fixGtkPopupStyle()
  5. fixHtmlDisplay(JComponent component)
  6. getClassLoaderForResources()
  7. getClassLoaderForResources()
  8. getDark()
  9. getDefaultActiveBackgroundColour()