@Override public boolean isInside(MouseEvent me) { if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) { return false; } Shape contour = SubstanceOutlineUtilities.getBaseOutline( this.passwordField, 2.0f * SubstanceSizeUtils .getClassicButtonCornerRadius(SubstanceSizeUtils .getComponentFontSize(this.passwordField)), null); return contour.contains(me.getPoint()); }
@Override public boolean isInside(MouseEvent me) { if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) { return false; } Shape contour = SubstanceOutlineUtilities.getBaseOutline( this.textField, 2.0f * SubstanceSizeUtils .getClassicButtonCornerRadius(SubstanceSizeUtils .getComponentFontSize(this.textField)), null); return contour.contains(me.getPoint()); }
@Override public boolean isInside(MouseEvent me) { if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) { return false; } Shape contour = SubstanceOutlineUtilities.getBaseOutline( this.textField, 2.0f * SubstanceSizeUtils .getClassicButtonCornerRadius(SubstanceSizeUtils .getComponentFontSize(this.textField)), null); return contour.contains(me.getPoint()); }
@Override public boolean isInside(MouseEvent me) { if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) { return false; } Shape contour = SubstanceOutlineUtilities.getBaseOutline( this.passwordField, 2.0f * SubstanceSizeUtils .getClassicButtonCornerRadius(SubstanceSizeUtils .getComponentFontSize(this.passwordField)), null); return contour.contains(me.getPoint()); }
/** * Paints the focus indication. * * @param g * Graphics. * @param bounds * Bounds for text. */ protected void paintFocus(Graphics g, Rectangle bounds) { int fontSize = SubstanceSizeUtils.getComponentFontSize(this.comboBox); int focusRingPadding = SubstanceSizeUtils.getFocusRingPadding(fontSize) / 2; int x = bounds.x; int y = bounds.y; Graphics2D g2d = (Graphics2D) g.create(); g2d.translate(x, y); SubstanceCoreUtilities.paintFocus(g2d, this.comboBox, this.comboBox, this, SubstanceOutlineUtilities.getBaseOutline(bounds.width, bounds.height, SubstanceSizeUtils .getClassicButtonCornerRadius(fontSize), null, 0), bounds, 1.0f, focusRingPadding); g2d.dispose(); }
@Override public boolean isInside(MouseEvent me) { if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) { return false; } Shape contour = SubstanceOutlineUtilities.getBaseOutline( this.textField, 2.0f * SubstanceSizeUtils .getClassicButtonCornerRadius(SubstanceSizeUtils .getComponentFontSize(this.textField)), null); return contour.contains(me.getPoint()); }
@Override public boolean isInside(MouseEvent me) { if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) { return false; } Shape contour = SubstanceOutlineUtilities.getBaseOutline( this.textField, 2.0f * SubstanceSizeUtils .getClassicButtonCornerRadius(SubstanceSizeUtils .getComponentFontSize(this.textField)), null); return contour.contains(me.getPoint()); }
/** * Paints the focus indication. * * @param g * Graphics. * @param bounds * Bounds for text. */ protected void paintFocus(Graphics g, Rectangle bounds) { int fontSize = SubstanceSizeUtils.getComponentFontSize(this.comboBox); int focusRingPadding = SubstanceSizeUtils.getFocusRingPadding(fontSize) / 2; int x = bounds.x; int y = bounds.y; Graphics2D g2d = (Graphics2D) g.create(); g2d.translate(x, y); SubstanceCoreUtilities.paintFocus(g2d, this.comboBox, this.comboBox, this, SubstanceOutlineUtilities.getBaseOutline(bounds.width, bounds.height, SubstanceSizeUtils .getClassicButtonCornerRadius(fontSize), null, 0), bounds, 1.0f, focusRingPadding); g2d.dispose(); }
@Override public void paint(Graphics g, JComponent c) { Graphics2D graphics = (Graphics2D) g.create(); int componentFontSize = SubstanceSizeUtils .getComponentFontSize(this.datePicker); int borderDelta = (int) Math.floor(SubstanceSizeUtils .getBorderStrokeWidth(componentFontSize)); Shape contour = SubstanceOutlineUtilities.getBaseOutline(datePicker .getWidth(), datePicker.getHeight(), Math.max(0, 2.0f * SubstanceSizeUtils .getClassicButtonCornerRadius(componentFontSize) - borderDelta), null, borderDelta); graphics.setColor(SubstanceTextUtilities .getTextBackgroundFillColor(this.datePicker)); graphics.fill(contour); super.paint(g, c); }
@Override public boolean isInside(MouseEvent me) { if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) { return false; } SubstanceButtonShaper shaper = ClassicButtonShaper.INSTANCE; if (shaper == null) return false; Shape contour = SubstanceOutlineUtilities.getBaseOutline(this.comboBox, SubstanceSizeUtils .getClassicButtonCornerRadius(SubstanceSizeUtils .getComponentFontSize(this.comboBox)), null); return contour.contains(me.getPoint()); } }
@Override public boolean isInside(MouseEvent me) { if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) { return false; } SubstanceButtonShaper shaper = ClassicButtonShaper.INSTANCE; if (shaper == null) return false; Shape contour = SubstanceOutlineUtilities.getBaseOutline(this.comboBox, SubstanceSizeUtils .getClassicButtonCornerRadius(SubstanceSizeUtils .getComponentFontSize(this.comboBox)), null); return contour.contains(me.getPoint()); } }
@Override public void paint(Graphics g, JComponent c) { super.paint(g, c); Graphics2D graphics = (Graphics2D) g.create(); int width = this.spinner.getWidth(); int height = this.spinner.getHeight(); int componentFontSize = SubstanceSizeUtils .getComponentFontSize(this.spinner); int borderDelta = (int) Math.floor(SubstanceSizeUtils .getBorderStrokeWidth(componentFontSize)); Shape contour = SubstanceOutlineUtilities .getBaseOutline( width, height, Math.max( 0, 2.0f * SubstanceSizeUtils .getClassicButtonCornerRadius(componentFontSize) - borderDelta), null, borderDelta); graphics.setColor(SubstanceTextUtilities .getTextBackgroundFillColor(this.spinner)); graphics.fill(contour); graphics.dispose(); }
@Override public void paint(Graphics g, JComponent c) { super.paint(g, c); Graphics2D graphics = (Graphics2D) g.create(); int width = this.spinner.getWidth(); int height = this.spinner.getHeight(); int componentFontSize = SubstanceSizeUtils .getComponentFontSize(this.spinner); int borderDelta = (int) Math.floor(SubstanceSizeUtils .getBorderStrokeWidth(componentFontSize)); Shape contour = SubstanceOutlineUtilities .getBaseOutline( width, height, Math.max( 0, 2.0f * SubstanceSizeUtils .getClassicButtonCornerRadius(componentFontSize) - borderDelta), null, borderDelta); graphics.setColor(SubstanceTextUtilities .getTextBackgroundFillColor(this.spinner)); graphics.fill(contour); graphics.dispose(); }
@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); }
/** * Returns extra width for the specified tab. * * @param tabPlacement * Tab placement. * @param tabIndex * Tab index. * @return Extra width for the specified tab. */ protected int getTabExtraWidth(int tabPlacement, int tabIndex) { int extraWidth = 0; SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(this.tabPane); if (shaper instanceof ClassicButtonShaper) extraWidth = (int) (2.0 * SubstanceSizeUtils .getClassicButtonCornerRadius(SubstanceSizeUtils .getComponentFontSize(this.tabPane))); else extraWidth = super.calculateTabHeight(tabPlacement, tabIndex, this .getFontMetrics().getHeight()) / 3; if (SubstanceCoreUtilities.hasCloseButton(this.tabPane, tabIndex) && this.tabPane.isEnabledAt(tabIndex)) { extraWidth += (4 + SubstanceCoreUtilities.getCloseButtonSize( this.tabPane, tabIndex)); } // System.out.println(tabPane.getTitleAt(tabIndex) + ":" + extraWidth); return extraWidth; }
@Override public float getCornerRadius(AbstractButton button, Insets insets) { float radius = SubstanceSizeUtils .getClassicButtonCornerRadius(SubstanceSizeUtils .getComponentFontSize(button)); if (button instanceof SubstanceInternalArrowButton) { Border parentBorder = ((JComponent) button.getParent()).getBorder(); if (parentBorder instanceof SubstanceBorder) { radius *= ((SubstanceBorder) parentBorder) .getRadiusScaleFactor(); } } if (SubstanceCoreUtilities.isToolBarButton(button)) { radius = SubstanceCoreUtilities.getToolbarButtonCornerRadius( button, insets); } return radius; } }
/** * Returns extra width for the specified tab. * * @param tabPlacement * Tab placement. * @param tabIndex * Tab index. * @return Extra width for the specified tab. */ protected int getTabExtraWidth(int tabPlacement, int tabIndex) { int extraWidth = 0; SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(this.tabPane); if (shaper instanceof ClassicButtonShaper) extraWidth = (int) (2.0 * SubstanceSizeUtils .getClassicButtonCornerRadius(SubstanceSizeUtils .getComponentFontSize(this.tabPane))); else extraWidth = super.calculateTabHeight(tabPlacement, tabIndex, this .getFontMetrics().getHeight()) / 3; if (SubstanceCoreUtilities.hasCloseButton(this.tabPane, tabIndex) && this.tabPane.isEnabledAt(tabIndex)) { extraWidth += (4 + SubstanceCoreUtilities.getCloseButtonSize( this.tabPane, tabIndex)); } // System.out.println(tabPane.getTitleAt(tabIndex) + ":" + extraWidth); return extraWidth; }
@Override public float getCornerRadius(AbstractButton button, Insets insets) { float radius = SubstanceSizeUtils .getClassicButtonCornerRadius(SubstanceSizeUtils .getComponentFontSize(button)); if (button instanceof SubstanceInternalArrowButton) { Border parentBorder = ((JComponent) button.getParent()).getBorder(); if (parentBorder instanceof SubstanceBorder) { radius *= ((SubstanceBorder) parentBorder) .getRadiusScaleFactor(); } } if (SubstanceCoreUtilities.isToolBarButton(button)) { radius = SubstanceCoreUtilities.getToolbarButtonCornerRadius( button, insets); } return radius; } }
.getClassicButtonCornerRadius(SubstanceSizeUtils .getComponentFontSize(button)); if (button instanceof SubstanceInternalArrowButton) {