insets.bottom /= 2;
insets.right /= 2;
SubstanceFillPainter fillPainter = SubstanceCoreUtilities
.getFillPainter(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);
fillPainter.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);
fillPainter.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);
}
}
}