@Override public void paintFocus(Graphics g) { SubstanceCoreUtilities.paintFocus(g, this.slider, this.slider, this, null, null, 1.0f, (int) Math.ceil(SubstanceSizeUtils .getFocusStrokeWidth(SubstanceSizeUtils .getComponentFontSize(this.slider))) / 2); }
@Override public void paintFocus(Graphics g) { SubstanceCoreUtilities.paintFocus(g, this.slider, this.slider, this, null, null, 1.0f, (int) Math.ceil(SubstanceSizeUtils .getFocusStrokeWidth(SubstanceSizeUtils .getComponentFontSize(this.slider))) / 2); }
@Override protected void calculateTrackRect() { super.calculateTrackRect(); if (this.slider.getOrientation() == SwingConstants.HORIZONTAL) { this.trackRect.y = 3 + (int) Math.ceil(SubstanceSizeUtils .getFocusStrokeWidth(SubstanceSizeUtils .getComponentFontSize(this.slider))) + this.insetCache.top; } }
@Override protected void calculateTrackRect() { super.calculateTrackRect(); if (this.slider.getOrientation() == SwingConstants.HORIZONTAL) { this.trackRect.y = 3 + (int) Math.ceil(SubstanceSizeUtils .getFocusStrokeWidth(SubstanceSizeUtils .getComponentFontSize(this.slider))) + this.insetCache.top; } }
@Override public void paintFocus(Component mainComp, Component focusedComp, TransitionAwareUI transitionAwareUI, Graphics2D graphics, Shape focusShape, Rectangle textRect, int extraPadding) { if (textRect == null) return; int fontSize = SubstanceSizeUtils .getComponentFontSize(mainComp); float dashLength = getDashLength(fontSize); float dashGap = getDashGap(fontSize); float dashPhase = (dashLength + dashGap) * (1.0f - transitionAwareUI.getTransitionTracker() .getFocusLoopPosition()); graphics.setStroke(new BasicStroke(SubstanceSizeUtils .getFocusStrokeWidth(fontSize), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0.0f, new float[] { dashLength, dashGap }, dashPhase)); graphics.translate(textRect.x - 1, textRect.y); graphics.drawLine(0, textRect.height - 1, textRect.width, textRect.height - 1); graphics.dispose(); }
@Override public void paintFocus(Component mainComp, Component focusedComp, TransitionAwareUI transitionAwareUI, Graphics2D graphics, Shape focusShape, Rectangle textRect, int extraPadding) { if (textRect == null) return; int fontSize = SubstanceSizeUtils .getComponentFontSize(mainComp); float dashLength = getDashLength(fontSize); float dashGap = getDashGap(fontSize); float dashPhase = (dashLength + dashGap) * (1.0f - transitionAwareUI.getTransitionTracker() .getFocusLoopPosition()); graphics.setStroke(new BasicStroke(SubstanceSizeUtils .getFocusStrokeWidth(fontSize), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0.0f, new float[] { dashLength, dashGap }, dashPhase)); graphics.translate(textRect.x - 1, textRect.y); graphics.drawLine(0, textRect.height - 1, textRect.width, textRect.height - 1); graphics.dispose(); }
SubstanceSizeUtils.getFocusStrokeWidth(iSize), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
.getFocusStrokeWidth(iSize), BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
@Override public void paintFocus(Component mainComp, Component focusedComp, TransitionAwareUI transitionAwareUI, Graphics2D graphics, Shape focusShape, Rectangle textRect, int extraPadding) { if (textRect == null) return; if ((textRect.width == 0) || (textRect.height == 0)) return; int fontSize = SubstanceSizeUtils .getComponentFontSize(mainComp); float dashLength = getDashLength(fontSize); float dashGap = getDashGap(fontSize); float dashPhase = (dashLength + dashGap) * (1.0f - transitionAwareUI.getTransitionTracker() .getFocusLoopPosition()); graphics.setStroke(new BasicStroke(SubstanceSizeUtils .getFocusStrokeWidth(fontSize), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0.0f, new float[] { dashLength, dashGap }, dashPhase)); int delta = ((mainComp instanceof JComboBox) || (mainComp instanceof JSpinner)) ? 0 : 1; GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline( textRect.width + 2 * delta, textRect.height, SubstanceSizeUtils .getClassicButtonCornerRadius(fontSize), null); graphics.translate(textRect.x - delta, textRect.y); graphics.draw(contour); }
@Override public void paintFocus(Component mainComp, Component focusedComp, TransitionAwareUI transitionAwareUI, Graphics2D graphics, Shape focusShape, Rectangle textRect, int extraPadding) { if (textRect == null) return; if ((textRect.width == 0) || (textRect.height == 0)) return; int fontSize = SubstanceSizeUtils .getComponentFontSize(mainComp); float dashLength = getDashLength(fontSize); float dashGap = getDashGap(fontSize); float dashPhase = (dashLength + dashGap) * (1.0f - transitionAwareUI.getTransitionTracker() .getFocusLoopPosition()); graphics.setStroke(new BasicStroke(SubstanceSizeUtils .getFocusStrokeWidth(fontSize), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0.0f, new float[] { dashLength, dashGap }, dashPhase)); int delta = ((mainComp instanceof JComboBox) || (mainComp instanceof JSpinner)) ? 0 : 1; GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline( textRect.width + 2 * delta, textRect.height, SubstanceSizeUtils .getClassicButtonCornerRadius(fontSize), null); graphics.translate(textRect.x - delta, textRect.y); graphics.draw(contour); }
.getFocusLoopPosition()); float focusStrokeWidth = SubstanceSizeUtils .getFocusStrokeWidth(fontSize); graphics.setStroke(new BasicStroke(focusStrokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, .getFocusStrokeWidth(fontSize), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0.0f, new float[] { dashLength, dashGap }, dashPhase));
.getFocusLoopPosition()); float focusStrokeWidth = SubstanceSizeUtils .getFocusStrokeWidth(fontSize); graphics.setStroke(new BasicStroke(focusStrokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, .getFocusStrokeWidth(fontSize), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0.0f, new float[] { dashLength, dashGap }, dashPhase));
.getFocusLoopPosition()); graphics.setStroke(new BasicStroke(SubstanceSizeUtils .getFocusStrokeWidth(fontSize), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0.0f, new float[] { dashLength, dashGap }, dashPhase)); .getFocusLoopPosition()); graphics.setStroke(new BasicStroke(SubstanceSizeUtils .getFocusStrokeWidth(fontSize), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0.0f, new float[] { dashLength, dashGap }, dashPhase));
.getFocusLoopPosition()); graphics.setStroke(new BasicStroke(SubstanceSizeUtils .getFocusStrokeWidth(fontSize), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0.0f, new float[] { dashLength, dashGap }, dashPhase)); .getFocusLoopPosition()); graphics.setStroke(new BasicStroke(SubstanceSizeUtils .getFocusStrokeWidth(fontSize), BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 0.0f, new float[] { dashLength, dashGap }, dashPhase));
@Override protected void installDefaults(JSlider slider) { super.installDefaults(slider); Font f = slider.getFont(); if (f == null || f instanceof UIResource) { slider.setFont(new FontUIResource(SubstanceLookAndFeel .getFontPolicy().getFontSet("Substance", null) .getControlFont())); } int size = SubstanceSizeUtils.getSliderIconSize(SubstanceSizeUtils .getComponentFontSize(slider)); // System.out.println("Slider size : " + size); this.horizontalIcon = SubstanceIconFactory.getSliderHorizontalIcon( size, false); this.roundIcon = SubstanceIconFactory.getSliderRoundIcon(size); this.verticalIcon = SubstanceIconFactory.getSliderVerticalIcon(size, false); int focusIns = (int) Math.ceil(2.0 * SubstanceSizeUtils .getFocusStrokeWidth(SubstanceSizeUtils .getComponentFontSize(slider))); this.focusInsets = new Insets(focusIns, focusIns, focusIns, focusIns); }
@Override protected void installDefaults(JSlider slider) { super.installDefaults(slider); Font f = slider.getFont(); if (f == null || f instanceof UIResource) { slider.setFont(new FontUIResource(SubstanceLookAndFeel .getFontPolicy().getFontSet("Substance", null) .getControlFont())); } int size = SubstanceSizeUtils.getSliderIconSize(SubstanceSizeUtils .getComponentFontSize(slider)); // System.out.println("Slider size : " + size); this.horizontalIcon = SubstanceIconFactory.getSliderHorizontalIcon( size, false); this.roundIcon = SubstanceIconFactory.getSliderRoundIcon(size); this.verticalIcon = SubstanceIconFactory.getSliderVerticalIcon(size, false); int focusIns = (int) Math.ceil(2.0 * SubstanceSizeUtils .getFocusStrokeWidth(SubstanceSizeUtils .getComponentFontSize(slider))); this.focusInsets = new Insets(focusIns, focusIns, focusIns, focusIns); }