|
|
@ -50,6 +50,8 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis |
|
|
|
|
|
|
|
|
|
|
|
protected boolean mouseOverThumb = false; |
|
|
|
protected boolean mouseOverThumb = false; |
|
|
|
protected boolean mouseOverTrack = false; |
|
|
|
protected boolean mouseOverTrack = false; |
|
|
|
|
|
|
|
protected float trackState; |
|
|
|
|
|
|
|
protected float thumbState; |
|
|
|
protected float trackAlpha; |
|
|
|
protected float trackAlpha; |
|
|
|
protected float thumbAlpha; |
|
|
|
protected float thumbAlpha; |
|
|
|
|
|
|
|
|
|
|
@ -82,6 +84,14 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis |
|
|
|
return trackAlpha; |
|
|
|
return trackAlpha; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public float getTrackState() { |
|
|
|
|
|
|
|
return trackState; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public float getThumbState() { |
|
|
|
|
|
|
|
return thumbState; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public float getThumbAlpha() { |
|
|
|
public float getThumbAlpha() { |
|
|
|
return thumbAlpha; |
|
|
|
return thumbAlpha; |
|
|
|
} |
|
|
|
} |
|
|
@ -164,16 +174,19 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis |
|
|
|
if (!e.getValueIsAdjusting()) return; |
|
|
|
if (!e.getValueIsAdjusting()) return; |
|
|
|
|
|
|
|
|
|
|
|
JScrollBar scrollBar = (JScrollBar) e.getAdjustable(); |
|
|
|
JScrollBar scrollBar = (JScrollBar) e.getAdjustable(); |
|
|
|
int extent = scrollBar.getModel().getExtent(); |
|
|
|
|
|
|
|
int value = scrollBar.getValue() + extent; |
|
|
|
if (PropertyUtil.getBooleanProperty(scrollBar, KEY_HIGHLIGHT_ON_SCROLL)) { |
|
|
|
if (value == extent || value == scrollBar.getMaximum()) return; |
|
|
|
int extent = scrollBar.getModel().getExtent(); |
|
|
|
|
|
|
|
int value = scrollBar.getValue() + extent; |
|
|
|
Point p = MouseInfo.getPointerInfo().getLocation(); |
|
|
|
if (value == extent || value == scrollBar.getMaximum()) return; |
|
|
|
SwingUtilities.convertPointFromScreen(p, scrollbar); |
|
|
|
|
|
|
|
if (!ui.getThumbBounds().contains(p) && !e.getValueIsAdjusting()) { |
|
|
|
Point p = MouseInfo.getPointerInfo().getLocation(); |
|
|
|
if (!thumbFadeinAnimator.isRunning()) { |
|
|
|
SwingUtilities.convertPointFromScreen(p, scrollbar); |
|
|
|
mouseOverThumb = true; |
|
|
|
if (!ui.getThumbBounds().contains(p)) { |
|
|
|
resetThumbAnimator(); |
|
|
|
if (!thumbFadeinAnimator.isRunning()) { |
|
|
|
|
|
|
|
mouseOverThumb = true; |
|
|
|
|
|
|
|
resetThumbAnimator(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -234,8 +247,9 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void updateValue(final float value) { |
|
|
|
protected void updateValue(final float state, final float value) { |
|
|
|
trackAlpha = value; |
|
|
|
trackAlpha = value; |
|
|
|
|
|
|
|
trackState = state; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -246,8 +260,9 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void updateValue(final float value) { |
|
|
|
protected void updateValue(final float state, final float value) { |
|
|
|
trackAlpha = value; |
|
|
|
trackAlpha = value; |
|
|
|
|
|
|
|
trackState = state; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -258,8 +273,9 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void updateValue(final float value) { |
|
|
|
protected void updateValue(final float state, final float value) { |
|
|
|
thumbAlpha = value; |
|
|
|
thumbAlpha = value; |
|
|
|
|
|
|
|
thumbState = state; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -282,8 +298,9 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void updateValue(final float value) { |
|
|
|
protected void updateValue(final float state, final float value) { |
|
|
|
thumbAlpha = value; |
|
|
|
thumbAlpha = value; |
|
|
|
|
|
|
|
thumbState = state; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -304,18 +321,18 @@ public class DarkScrollBarListener extends MouseAdapter implements AdjustmentLis |
|
|
|
this.fadeIn = fadeIn; |
|
|
|
this.fadeIn = fadeIn; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected abstract void updateValue(final float value); |
|
|
|
protected abstract void updateValue(final float state, final float value); |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void paintNow(final float fraction) { |
|
|
|
public void paintNow(final float fraction) { |
|
|
|
float fr = fadeIn ? fraction : (1 - fraction); |
|
|
|
float fr = fadeIn ? fraction : (1 - fraction); |
|
|
|
updateValue(minValue + maxValue * fr); |
|
|
|
updateValue(fr, minValue + maxValue * fr); |
|
|
|
repaint(); |
|
|
|
repaint(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
protected void paintCycleEnd() { |
|
|
|
protected void paintCycleEnd() { |
|
|
|
updateValue(fadeIn ? maxValue : minValue); |
|
|
|
updateValue(fadeIn ? 1 : 0, fadeIn ? maxValue : minValue); |
|
|
|
repaint(); |
|
|
|
repaint(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|