/** * 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 outline that has a triangle poiting downwards. The top two * corners in the outline are rounded. This function can be used to draw * slider thumbs. * * @param width * Width of some UI component. * @param height * Height of some UI component. * @param radius * Corner radius for the top two corners. * @param insets * Insets to compute the outline. * @return Outline that has a triangle poiting downwards. */ public static GeneralPath getTriangleButtonOutline(int width, int height, float radius, int insets) { return getTriangleButtonOutline(width, height, radius, 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>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 outline that has a triangle poiting downwards. The top two * corners in the outline are rounded. This function can be used to draw * slider thumbs. * * @param width * Width of some UI component. * @param height * Height of some UI component. * @param radius * Corner radius for the top two corners. * @param insets * Insets to compute the outline. * @return Outline that has a triangle poiting downwards. */ public static GeneralPath getTriangleButtonOutline(int width, int height, float radius, int insets) { return getTriangleButtonOutline(width, height, radius, 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)); }
private Icon getSingleLayer(JSlider slider, int width, int delta, SubstanceFillPainter fillPainter, SubstanceBorderPainter borderPainter, SubstanceColorScheme fillScheme, SubstanceColorScheme borderScheme) { int borderDelta = (int) Math.floor(SubstanceSizeUtils .getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(slider)) / 2.0); Shape contour = SubstanceOutlineUtilities.getTriangleButtonOutline( width, this.size - 1, 2, borderDelta); BufferedImage stateImage = SubstanceCoreUtilities.getBlankImage( this.size - 1, this.size - 1); Graphics2D g2d = stateImage.createGraphics(); g2d.translate(delta, 0); fillPainter.paintContourBackground(g2d, slider, width, this.size - 1, contour, false, fillScheme, true); int borderThickness = (int) SubstanceSizeUtils .getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(slider)); GeneralPath contourInner = SubstanceOutlineUtilities .getTriangleButtonOutline(width, this.size - 1, 2, borderThickness + borderDelta); borderPainter.paintBorder(g2d, slider, width, this.size - 1, contour, contourInner, borderScheme); g2d.translate(-delta, 0); if (this.isMirrorred) stateImage = SubstanceImageCreator.getRotated(stateImage, 2); return new ImageIcon(stateImage); }
/** * 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)); }
private Icon getSingleLayer(JSlider slider, int width, int delta, SubstanceFillPainter fillPainter, SubstanceBorderPainter borderPainter, SubstanceColorScheme fillScheme, SubstanceColorScheme borderScheme) { int borderDelta = (int) Math.floor(SubstanceSizeUtils .getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(slider)) / 2.0); Shape contour = SubstanceOutlineUtilities.getTriangleButtonOutline( width, this.size - 1, 2, borderDelta); BufferedImage stateImage = SubstanceCoreUtilities.getBlankImage( this.size - 1, this.size - 1); Graphics2D g2d = stateImage.createGraphics(); g2d.translate(delta, 0); fillPainter.paintContourBackground(g2d, slider, width, this.size - 1, contour, false, fillScheme, true); int borderThickness = (int) SubstanceSizeUtils .getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(slider)); GeneralPath contourInner = SubstanceOutlineUtilities .getTriangleButtonOutline(width, this.size - 1, 2, borderThickness + borderDelta); borderPainter.paintBorder(g2d, slider, width, this.size - 1, contour, contourInner, borderScheme); g2d.translate(-delta, 0); if (this.isMirrorred) stateImage = SubstanceImageCreator.getRotated(stateImage, 2); return new ImageIcon(stateImage); }
/** * 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); }
.getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(slider)) / 2.0); Shape contour = SubstanceOutlineUtilities.getTriangleButtonOutline( height, this.size, 2, borderDelta); .getComponentFontSize(slider)); GeneralPath contourInner = SubstanceOutlineUtilities .getTriangleButtonOutline(height, this.size, 2, borderThickness + borderDelta);
/** * 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); }
.getBorderStrokeWidth(SubstanceSizeUtils .getComponentFontSize(slider)) / 2.0); Shape contour = SubstanceOutlineUtilities.getTriangleButtonOutline( height, this.size, 2, borderDelta); .getComponentFontSize(slider)); GeneralPath contourInner = SubstanceOutlineUtilities .getTriangleButtonOutline(height, this.size, 2, borderThickness + borderDelta);
@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()); }
@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()); }
/** * 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(); }