mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 22:10:54 +03:00
Extras: FlatAnimatedLafChange: made animated Laf change transition smoother
This commit is contained in:
@@ -19,6 +19,7 @@ package com.formdev.flatlaf.extras;
|
|||||||
import java.awt.AlphaComposite;
|
import java.awt.AlphaComposite;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Toolkit;
|
||||||
import java.awt.Window;
|
import java.awt.Window;
|
||||||
import java.awt.image.VolatileImage;
|
import java.awt.image.VolatileImage;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -51,9 +52,9 @@ public class FlatAnimatedLafChange
|
|||||||
public static int duration = 160;
|
public static int duration = 160;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The resolution of the animation in milliseconds. Default is 40 ms.
|
* The resolution of the animation in milliseconds. Default is 30 ms.
|
||||||
*/
|
*/
|
||||||
public static int resolution = 40;
|
public static int resolution = 30;
|
||||||
|
|
||||||
private static Animator animator;
|
private static Animator animator;
|
||||||
private static final Map<JLayeredPane, JComponent> oldUIsnapshots = new WeakHashMap<>();
|
private static final Map<JLayeredPane, JComponent> oldUIsnapshots = new WeakHashMap<>();
|
||||||
@@ -158,6 +159,8 @@ public class FlatAnimatedLafChange
|
|||||||
if( e.getKey().isShowing() )
|
if( e.getKey().isShowing() )
|
||||||
e.getValue().repaint();
|
e.getValue().repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Toolkit.getDefaultToolkit().sync();
|
||||||
}, () -> {
|
}, () -> {
|
||||||
hideSnapshot();
|
hideSnapshot();
|
||||||
animator = null;
|
animator = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user