insets.top /= 2;
insets.left /= 2;
insets.bottom /= 2;
insets.right /= 2;
SubstanceGradientPainter gp = SubstanceCoreUtilities
.getGradientPainter(this.slider);
SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
.getBorderPainter(this.slider);
float radius = SubstanceSizeUtils
.getClassicButtonCornerRadius(SubstanceSizeUtils
.getComponentFontSize(slider)) / 2.0f;
int borderDelta = (int) Math.floor(SubstanceSizeUtils
.getBorderStrokeWidth(SubstanceSizeUtils
.getComponentFontSize(slider)) / 2.0);
// fill selected portion
if (this.slider.isEnabled()) {
if (this.slider.getOrientation() == SwingConstants.HORIZONTAL) {
int middleOfThumb = this.thumbRect.x
+ (this.thumbRect.width / 2) - paintRect.x;
int fillMinX;
int fillMaxX;
if (drawInverted) {
fillMinX = middleOfThumb;
fillMaxX = width;
} else {
fillMinX = 0;
fillMaxX = middleOfThumb;
}
int fillWidth = fillMaxX - fillMinX;
int fillHeight = height + 1;
if ((fillWidth > 0) && (fillHeight > 0)) {
Shape contour = SubstanceOutlineUtilities.getBaseOutline(
fillWidth, fillHeight, radius, null, borderDelta);
g2d.translate(fillMinX, 0);
gp.paintContourBackground(g2d, this.slider, fillWidth,
fillHeight, contour, false, fillScheme, fillScheme,
0.0f, false, false);
borderPainter.paintBorder(g2d, this.slider, fillWidth,
fillHeight, contour, null, borderScheme,
borderScheme, 0.0f, false);
}
} else {
int middleOfThumb = this.thumbRect.y
+ (this.thumbRect.height / 2) - paintRect.y;
int fillMin;
int fillMax;
if (this.drawInverted()) {
fillMin = 0;
fillMax = middleOfThumb;
// fix for issue 368 - inverted vertical sliders
g2d.translate(width + 2 - middleOfThumb, 0);
} else {
fillMin = middleOfThumb;
fillMax = width + 1;
}
int fillWidth = fillMax - fillMin;
int fillHeight = height + 1;
if ((fillWidth > 0) && (fillHeight > 0)) {
Shape contour = SubstanceOutlineUtilities.getBaseOutline(
fillWidth, fillHeight, radius, null, borderDelta);
gp.paintContourBackground(g2d, this.slider, fillWidth,
fillHeight, contour, false, fillScheme, fillScheme,
0.0f, false, false);
borderPainter.paintBorder(g2d, this.slider, fillWidth,
fillHeight, contour, null, borderScheme,
borderScheme, 0.0f, false);