Browse Source

Only start animation if window is undecorated and a target component is set.

pull/222/head
weisj 4 years ago
parent
commit
8b1b5549d4
  1. 8
      core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkToolTipUI.java
  2. 6
      core/src/main/java/com/github/weisj/darklaf/util/DarkUIUtil.java

8
core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkToolTipUI.java

@ -397,10 +397,16 @@ public class DarkToolTipUI extends BasicToolTipUI
super(FADEIN_FRAMES_COUNT, FADEIN_FRAMES_COUNT * 15, false);
}
@Override
public boolean isEnabled() {
return toolTip.getComponent() != null && super.isEnabled();
}
@Override
public void paintNow(final float fraction) {
alpha = fraction * MAX_ALPHA;
Window window = SwingUtilities.getWindowAncestor(toolTip);
if (DarkUIUtil.isDecorated(window)) return;
if (window != null) window.setOpacity(alpha);
Border border = toolTip.getBorder();
if (border instanceof DarkTooltipBorder) {
@ -412,7 +418,7 @@ public class DarkToolTipUI extends BasicToolTipUI
protected void paintCycleEnd() {
alpha = MAX_ALPHA;
Window window = SwingUtilities.getWindowAncestor(toolTip);
if (window != null) {
if (window != null && !DarkUIUtil.isDecorated(window)) {
window.setOpacity(alpha);
Border border = toolTip.getBorder();
if (window.getFocusableWindowState() && border instanceof DarkTooltipBorder) {

6
core/src/main/java/com/github/weisj/darklaf/util/DarkUIUtil.java

@ -528,4 +528,10 @@ public final class DarkUIUtil {
if (type != null && type.isInstance(o)) return type.cast(o);
return null;
}
public static boolean isDecorated(final Window window) {
if (window instanceof Frame) return ((Frame) window).isUndecorated();
if (window instanceof Dialog) return ((Dialog) window).isUndecorated();
return false;
}
}

Loading…
Cancel
Save