Package com.formdev.flatlaf.extras
Class FlatAnimatedLafChange
- java.lang.Object
-
- com.formdev.flatlaf.extras.FlatAnimatedLafChange
-
public class FlatAnimatedLafChange extends java.lang.ObjectAnimated look and feel changing.Invoke
showSnapshot()before setting look and feel andhideSnapshotWithAnimation()after updating UI. E.g.FlatAnimatedLafChange.showSnapshot(); UIManager.setLookAndFeel( lafClassName ); FlatLaf.updateUI(); FlatAnimatedLafChange.hideSnapshotWithAnimation();
-
-
Field Summary
Fields Modifier and Type Field Description private static floatalphaprivate static Animatoranimatorstatic intdurationThe duration of the animation in milliseconds.private static booleaninShowSnapshotprivate static java.util.Map<javax.swing.JLayeredPane,javax.swing.JComponent>newUIsnapshotsprivate static java.util.Map<javax.swing.JLayeredPane,javax.swing.JComponent>oldUIsnapshotsstatic intresolutionThe resolution of the animation in milliseconds.
-
Constructor Summary
Constructors Constructor Description FlatAnimatedLafChange()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voidhideSnapshot()private static voidhideSnapshot(java.util.Map<javax.swing.JLayeredPane,javax.swing.JComponent> map)static voidhideSnapshotWithAnimation()Starts an animation that shows the snapshot (created byshowSnapshot()) with a decreasing alpha.static voidshowSnapshot()Create a snapshot of the old UI and shows it on top of the UI.private static voidshowSnapshot(boolean useAlpha, java.util.Map<javax.swing.JLayeredPane,javax.swing.JComponent> map)static voidstop()Stops a running animation (if any) and hides the snapshot.
-
-
-
Field Detail
-
duration
public static int duration
The duration of the animation in milliseconds. Default is 160 ms.
-
resolution
public static int resolution
The resolution of the animation in milliseconds. Default is 30 ms.
-
animator
private static Animator animator
-
oldUIsnapshots
private static final java.util.Map<javax.swing.JLayeredPane,javax.swing.JComponent> oldUIsnapshots
-
newUIsnapshots
private static final java.util.Map<javax.swing.JLayeredPane,javax.swing.JComponent> newUIsnapshots
-
alpha
private static float alpha
-
inShowSnapshot
private static boolean inShowSnapshot
-
-
Method Detail
-
showSnapshot
public static void showSnapshot()
Create a snapshot of the old UI and shows it on top of the UI. Invoke before setting new look and feel.
-
showSnapshot
private static void showSnapshot(boolean useAlpha, java.util.Map<javax.swing.JLayeredPane,javax.swing.JComponent> map)
-
hideSnapshotWithAnimation
public static void hideSnapshotWithAnimation()
Starts an animation that shows the snapshot (created byshowSnapshot()) with a decreasing alpha. At the end, the snapshot is removed and the new UI is shown. Invoke after updating UI.
-
hideSnapshot
private static void hideSnapshot()
-
hideSnapshot
private static void hideSnapshot(java.util.Map<javax.swing.JLayeredPane,javax.swing.JComponent> map)
-
stop
public static void stop()
Stops a running animation (if any) and hides the snapshot.
-
-