/** * Returns the image for a horizontal track. * * @param scrollBar * Scroll bar. * @param leftActiveButton * The closest left button in the scroll bar. May be * <code>null</code>. * @param rightActiveButton * The closest right button in the scroll bar. May be * <code>null</code> . * @param width * Scroll track width. * @param height * Scroll track height. * @return Horizontal track image. */ private static void paintTrackBackHorizontal(Graphics g, JScrollBar scrollBar, AbstractButton leftActiveButton, AbstractButton rightActiveButton, int width, int height) { SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(scrollBar); int radius = height / 2; if (shaper instanceof ClassicButtonShaper) radius = 2; SubstanceImageCreator.paintCompositeRoundedBackground(scrollBar, g, width, height, radius, leftActiveButton, rightActiveButton, false); }
AbstractButton rightActiveButton, int width, int height) { SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(scrollBar); int radius = height / 2; if (shaper instanceof ClassicButtonShaper)
@Override public Dimension getPreferredSize(JComponent c) { AbstractButton button = (AbstractButton) c; SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(button); // fix for defect 263 Dimension superPref = super.getPreferredSize(button); if (superPref == null) return null; if (shaper == null) return superPref; return shaper.getPreferredSize(button, superPref); }
@Override public Dimension getPreferredSize(JComponent c) { AbstractButton button = (AbstractButton) c; SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(button); // fix for defect 263 Dimension superPref = super.getPreferredSize(button); if (superPref == null) return null; if (shaper == null) return superPref; return shaper.getPreferredSize(button, superPref); }
@Override public Dimension getPreferredSize(JComponent c) { AbstractButton button = (AbstractButton) c; SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(button); // fix for defect 263 Dimension superPref = super.getPreferredSize(button); if (superPref == null) return null; if (shaper == null) return superPref; Dimension result = shaper.getPreferredSize(button, superPref); return result; }
@Override public Dimension getPreferredSize(JComponent c) { AbstractButton button = (AbstractButton) c; SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(button); // fix for defect 263 Dimension superPref = super.getPreferredSize(button); if (superPref == null) return null; if (shaper == null) return superPref; Dimension result = shaper.getPreferredSize(button, superPref); return result; }
AbstractButton bottomActiveButton, int width, int height) { SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(scrollBar); int radius = width / 2; if (shaper instanceof ClassicButtonShaper)
AbstractButton bottomActiveButton, int width, int height) { SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(scrollBar); int radius = width / 2; if (shaper instanceof ClassicButtonShaper)
&& !(mainComp instanceof JCheckBox) && !(mainComp instanceof JRadioButton))) { SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(mainComp); if (shaper == null) return;
&& !(mainComp instanceof JCheckBox) && !(mainComp instanceof JRadioButton))) { SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(mainComp); if (shaper == null) return;
/** * 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; }
/** * 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; }
/** * Returns <code>true</code> if the specified <i>x,y </i> location is * contained within the look and feel's defined shape of the specified * component. <code>x</code> and <code>y</code> are defined to be relative * to the coordinate system of the specified component. * * @param button * the component where the <i>x,y </i> location is being queried; * @param x * the <i>x </i> coordinate of the point * @param y * the <i>y </i> coordinate of the point * @return <code>true</code> if the specified <i>x,y </i> location is * contained within the look and feel's defined shape of the * specified component, <code>false</code> otherwise. */ public static boolean contains(AbstractButton button, int x, int y) { // failsafe for LAF change if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) { return false; } SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(button); if (shaper == null) return false; Shape contour = shaper.getButtonOutline(button, null, button.getWidth(), button.getHeight(), false); return contour.contains(x, y); }
/** * Returns <code>true</code> if the specified <i>x,y </i> location is * contained within the look and feel's defined shape of the specified * component. <code>x</code> and <code>y</code> are defined to be relative * to the coordinate system of the specified component. * * @param button * the component where the <i>x,y </i> location is being queried; * @param x * the <i>x </i> coordinate of the point * @param y * the <i>y </i> coordinate of the point * @return <code>true</code> if the specified <i>x,y </i> location is * contained within the look and feel's defined shape of the * specified component, <code>false</code> otherwise. */ public static boolean contains(AbstractButton button, int x, int y) { // failsafe for LAF change if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) { return false; } SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(button); if (shaper == null) return false; Shape contour = shaper.getButtonOutline(button, null, button.getWidth(), button.getHeight(), false); return contour.contains(x, y); }
.getFillPainter(scrollBar); SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(scrollBar); SubstanceBorderPainter borderPainter = SubstanceCoreUtilities .getBorderPainter(scrollBar);
int width, int height) { SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(scrollBar); SubstanceColorScheme mainScheme = SubstanceColorSchemeUtilities .getColorScheme(scrollBar,
@Override protected void installDefaults(AbstractButton b) { super.installDefaults(b); if (b.getClientProperty(SubstanceButtonUI.BORDER_ORIGINAL) == null) b.putClientProperty(SubstanceButtonUI.BORDER_ORIGINAL, b .getBorder()); SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(b); if (b.getClientProperty(SubstanceButtonUI.BORDER_COMPUTED) == null) { b.setBorder(shaper.getButtonBorder(b)); } else { Border currBorder = b.getBorder(); if (!(currBorder instanceof SubstanceButtonBorder)) { b.setBorder(shaper.getButtonBorder(b)); } else { SubstanceButtonBorder sbCurrBorder = (SubstanceButtonBorder) currBorder; if (shaper.getClass() != sbCurrBorder.getButtonShaperClass()) b.setBorder(shaper.getButtonBorder(b)); } } b.putClientProperty(SubstanceButtonUI.OPACITY_ORIGINAL, b.isOpaque()); b.setOpaque(false); b.setRolloverEnabled(true); LookAndFeel.installProperty(b, "iconTextGap", SubstanceSizeUtils .getTextIconGap(SubstanceSizeUtils.getComponentFontSize(b))); if (Boolean.TRUE.equals(b .getClientProperty(SubstanceLookAndFeel.WINDOW_MODIFIED))) { trackModificationFlag(); } }
@Override protected void installDefaults(AbstractButton b) { super.installDefaults(b); if (b.getClientProperty(SubstanceButtonUI.BORDER_ORIGINAL) == null) b.putClientProperty(SubstanceButtonUI.BORDER_ORIGINAL, b .getBorder()); SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(b); if (b.getClientProperty(SubstanceButtonUI.BORDER_COMPUTED) == null) { b.setBorder(shaper.getButtonBorder(b)); } else { Border currBorder = b.getBorder(); if (!(currBorder instanceof SubstanceButtonBorder)) { b.setBorder(shaper.getButtonBorder(b)); } else { SubstanceButtonBorder sbCurrBorder = (SubstanceButtonBorder) currBorder; if (shaper.getClass() != sbCurrBorder.getButtonShaperClass()) b.setBorder(shaper.getButtonBorder(b)); } } b.putClientProperty(SubstanceButtonUI.OPACITY_ORIGINAL, b.isOpaque()); b.setOpaque(false); b.setRolloverEnabled(true); LookAndFeel.installProperty(b, "iconTextGap", SubstanceSizeUtils .getTextIconGap(SubstanceSizeUtils.getComponentFontSize(b))); if (Boolean.TRUE.equals(b .getClientProperty(SubstanceLookAndFeel.WINDOW_MODIFIED))) { trackModificationFlag(); } }
@Override public void installDefaults(AbstractButton b) { super.installDefaults(b); if (b.getClientProperty(SubstanceButtonUI.BORDER_ORIGINAL) == null) b.putClientProperty(SubstanceButtonUI.BORDER_ORIGINAL, b .getBorder()); if (b.getClientProperty(SubstanceButtonUI.BORDER_ORIGINAL) == null) b.putClientProperty(SubstanceButtonUI.BORDER_ORIGINAL, b .getBorder()); SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(b); if (b.getClientProperty(SubstanceButtonUI.BORDER_COMPUTED) == null) { b.setBorder(shaper.getButtonBorder(b)); } else { Border currBorder = b.getBorder(); if (!(currBorder instanceof SubstanceButtonBorder)) { b.setBorder(shaper.getButtonBorder(b)); } else { SubstanceButtonBorder sbCurrBorder = (SubstanceButtonBorder) currBorder; if (shaper.getClass() != sbCurrBorder.getButtonShaperClass()) b.setBorder(shaper.getButtonBorder(b)); } } b.putClientProperty(SubstanceButtonUI.OPACITY_ORIGINAL, b.isOpaque()); // fix for defect 140 b.setOpaque(false); b.setRolloverEnabled(true); LookAndFeel.installProperty(b, "iconTextGap", SubstanceSizeUtils .getTextIconGap(SubstanceSizeUtils.getComponentFontSize(b))); }
@Override public void installDefaults(AbstractButton b) { super.installDefaults(b); if (b.getClientProperty(SubstanceButtonUI.BORDER_ORIGINAL) == null) b.putClientProperty(SubstanceButtonUI.BORDER_ORIGINAL, b .getBorder()); if (b.getClientProperty(SubstanceButtonUI.BORDER_ORIGINAL) == null) b.putClientProperty(SubstanceButtonUI.BORDER_ORIGINAL, b .getBorder()); SubstanceButtonShaper shaper = SubstanceCoreUtilities .getButtonShaper(b); if (b.getClientProperty(SubstanceButtonUI.BORDER_COMPUTED) == null) { b.setBorder(shaper.getButtonBorder(b)); } else { Border currBorder = b.getBorder(); if (!(currBorder instanceof SubstanceButtonBorder)) { b.setBorder(shaper.getButtonBorder(b)); } else { SubstanceButtonBorder sbCurrBorder = (SubstanceButtonBorder) currBorder; if (shaper.getClass() != sbCurrBorder.getButtonShaperClass()) b.setBorder(shaper.getButtonBorder(b)); } } b.putClientProperty(SubstanceButtonUI.OPACITY_ORIGINAL, b.isOpaque()); // fix for defect 140 b.setOpaque(false); b.setRolloverEnabled(true); LookAndFeel.installProperty(b, "iconTextGap", SubstanceSizeUtils .getTextIconGap(SubstanceSizeUtils.getComponentFontSize(b))); }