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.Graphics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.Window;
|
||||
import java.awt.image.VolatileImage;
|
||||
import java.util.Map;
|
||||
@@ -51,9 +52,9 @@ public class FlatAnimatedLafChange
|
||||
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 final Map<JLayeredPane, JComponent> oldUIsnapshots = new WeakHashMap<>();
|
||||
@@ -158,6 +159,8 @@ public class FlatAnimatedLafChange
|
||||
if( e.getKey().isShowing() )
|
||||
e.getValue().repaint();
|
||||
}
|
||||
|
||||
Toolkit.getDefaultToolkit().sync();
|
||||
}, () -> {
|
||||
hideSnapshot();
|
||||
animator = null;
|
||||
|
||||
Reference in New Issue
Block a user