/** * Returns basic outline for the specified parameters. The basic outline is * a rectangle with rounded corners. Some corners may not be rounded based * on the contents of <code>straightSide</code> parameter. * * @param width * Width of some UI component. * @param height * Height of some UI component. * @param radius * Corner radius. * @param straightSides * Contains all sides which are straight. * @return The basic outline for the specified parameters. */ public static GeneralPath getBaseOutline(int width, int height, float radius, Set<Side> straightSides) { return getBaseOutline(width, height, radius, straightSides, null); }
/** * Returns basic outline for the specified parameters. The basic outline is * a rectangle with rounded corners. Some corners may not be rounded based * on the contents of <code>straightSide</code> parameter. * * @param width * Width of some UI component. * @param height * Height of some UI component. * @param radius * Corner radius. * @param straightSides * Contains all sides which are straight. * @return The basic outline for the specified parameters. */ public static GeneralPath getBaseOutline(int width, int height, float radius, Set<Side> straightSides) { return getBaseOutline(width, height, radius, straightSides, null); }
/** * Returns basic outline for the specified parameters. The basic outline is * a rectangle with rounded corners. Some corners may not be rounded based * on the contents of <code>straightSides</code> parameter. * * @param width * Width of some UI component. * @param height * Height of some UI component. * @param radius * Corner radius. * @param straightSides * Contains all sides which are straight. * @param insets * Shape insets. * @return The basic outline for the specified parameters. */ public static GeneralPath getBaseOutline(int width, int height, float radius, Set<Side> straightSides, int insets) { return getBaseOutline(width, height, radius, straightSides, new Insets( insets, insets, insets, insets)); }
/** * Returns basic outline for the specified parameters. The basic outline is * a rectangle with rounded corners. Some corners may not be rounded based * on the contents of <code>straightSides</code> parameter. * * @param width * Width of some UI component. * @param height * Height of some UI component. * @param radius * Corner radius. * @param straightSides * Contains all sides which are straight. * @param insets * Shape insets. * @return The basic outline for the specified parameters. */ public static GeneralPath getBaseOutline(int width, int height, float radius, Set<Side> straightSides, int insets) { return getBaseOutline(width, height, radius, straightSides, new Insets( insets, insets, insets, insets)); }
/** * Returns basic outline for the specified component. The basic outline is a * rectangle with rounded corners. Some corners may not be rounded based on * the contents of <code>straightSide</code> parameter. * * @param comp * Component. * @param radius * Corner radius. * @param straightSides * Contains all sides which are straight. * @return The basic outline for the specified parameters. */ public static GeneralPath getBaseOutline(Component comp, float radius, Set<Side> straightSides) { int width = comp.getWidth(); int height = comp.getHeight(); return getBaseOutline(width, height, radius, straightSides); }
/** * Returns basic outline for the specified component. The basic outline is a * rectangle with rounded corners. Some corners may not be rounded based on * the contents of <code>straightSide</code> parameter. * * @param comp * Component. * @param radius * Corner radius. * @param straightSides * Contains all sides which are straight. * @return The basic outline for the specified parameters. */ public static GeneralPath getBaseOutline(Component comp, float radius, Set<Side> straightSides) { int width = comp.getWidth(); int height = comp.getHeight(); return getBaseOutline(width, height, radius, straightSides); }
@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()); }
@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); }
/** * 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; } 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 GeneralPath getButtonOutline(AbstractButton button, Insets insets, int width, int height, boolean isInner) { Set<SubstanceConstants.Side> straightSides = SubstanceCoreUtilities .getSides(button, SubstanceLookAndFeel.BUTTON_SIDE_PROPERTY); float radius = this.getCornerRadius(button, insets); if (isInner) { radius -= (int) SubstanceSizeUtils .getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(button)); if (radius < 0.0f) radius = 0.0f; } HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height, straightSides, radius, insets); GeneralPath result = contours.get(key); if (result != null) { return result; } result = SubstanceOutlineUtilities.getBaseOutline(width, height, radius, straightSides, insets); contours.put(key, result); return result; }
@Override public GeneralPath getButtonOutline(AbstractButton button, Insets insets, int width, int height, boolean isInner) { Set<SubstanceConstants.Side> straightSides = SubstanceCoreUtilities .getSides(button, SubstanceLookAndFeel.BUTTON_SIDE_PROPERTY); float radius = this.getCornerRadius(button, insets); if (isInner) { radius -= (int) SubstanceSizeUtils .getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(button)); if (radius < 0.0f) radius = 0.0f; } HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height, straightSides, radius, insets); GeneralPath result = contours.get(key); if (result != null) { return result; } result = SubstanceOutlineUtilities.getBaseOutline(width, height, radius, straightSides, insets); contours.put(key, result); return result; }
@Override public GeneralPath getButtonOutline(AbstractButton button, Insets insets, int width, int height, boolean isInner) { Set<SubstanceConstants.Side> straightSides = SubstanceCoreUtilities .getSides(button, SubstanceLookAndFeel.BUTTON_SIDE_PROPERTY); float radius = this.getCornerRadius(button, insets); if (isInner) { radius -= (int) SubstanceSizeUtils .getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(button)); if (radius < 0.0f) radius = 0.0f; } HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height, straightSides, radius, insets); GeneralPath result = contours.get(key); if (result != null) { return result; } result = SubstanceOutlineUtilities.getBaseOutline(width, height, radius, straightSides, insets); contours.put(key, result); return result; }