Browse Source

smoother tooltip fade in

Signed-off-by: weisj <weisj@arcor.de>
pull/60/head
weisj 5 years ago
parent
commit
23a38f0d94
  1. 8
      core/src/main/java/com/github/weisj/darklaf/components/tooltip/DarkToolTip.java
  2. 2
      core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkTooltipUI.java

8
core/src/main/java/com/github/weisj/darklaf/components/tooltip/DarkToolTip.java

@ -54,12 +54,16 @@ public class DarkToolTip extends JToolTip implements PropertyChangeListener {
addAncestorListener(new AncestorAdapter() {
@Override
public void ancestorAdded(final AncestorEvent event) {
setVisible(true);
notifyToolTipListeners(ToolTipEvent.SHOWN);
boolean resume = false;
if (Math.abs(System.currentTimeMillis() - lastHidden) < REPAINT_THRESHOLD) {
alpha = 1.0f;
} else {
alpha = 0;
resume = true;
}
setVisible(true);
notifyToolTipListeners(ToolTipEvent.SHOWN);
if (resume) {
fadeAnimator.reset();
fadeAnimator.resume();
}

2
core/src/main/java/com/github/weisj/darklaf/ui/tooltip/DarkTooltipUI.java

@ -193,7 +193,7 @@ public class DarkTooltipUI extends BasicToolTipUI implements PropertyChangeListe
@Override
public void hierarchyChanged(final HierarchyEvent e) {
Window w = SwingUtilities.getWindowAncestor(toolTip);
if (w != null && !isDecorated(w) && w.getClass().getEnclosingClass().equals(Popup.class)) {
if (w != null && !isDecorated(w) && (w.getClass().getEnclosingClass().equals(Popup.class))) {
w.setBackground(DarkUIUtil.TRANSPARENT_COLOR);
}
}

Loading…
Cancel
Save