private void drawBorder(Graphics2D g, Shape shape, int width, int height) { Paint p = getBorderPaint(); if(isPaintStretched()) { p = calculateSnappedPaint(p, width, height); } g.setPaint(p); g.setStroke(new BasicStroke(getBorderWidth())); // shrink the border by 1 px if(shape instanceof Rectangle2D) { Rectangle2D rect = (Rectangle2D) shape; g.draw(new Rectangle2D.Double(rect.getX(), rect.getY(), rect.getWidth()-1, rect.getHeight()-1)); } else if(shape instanceof RoundRectangle2D) { RoundRectangle2D rect = (RoundRectangle2D) shape; g.draw(new RoundRectangle2D.Double(rect.getX(), rect.getY(), rect.getWidth()-1, rect.getHeight()-1, rect.getArcWidth(), rect.getArcHeight())); } else { g.draw(shape); } }
private void drawBorder(Graphics2D g, Shape shape, int width, int height) { Paint p = getBorderPaint(); if(isPaintStretched()) { p = calculateSnappedPaint(p, width, height); } g.setPaint(p); g.setStroke(new BasicStroke(getBorderWidth())); // shrink the border by 1 px if(shape instanceof Rectangle2D) { Rectangle2D rect = (Rectangle2D) shape; g.draw(new Rectangle2D.Double(rect.getX(), rect.getY(), rect.getWidth()-1, rect.getHeight()-1)); } else if(shape instanceof RoundRectangle2D) { RoundRectangle2D rect = (RoundRectangle2D) shape; g.draw(new RoundRectangle2D.Double(rect.getX(), rect.getY(), rect.getWidth()-1, rect.getHeight()-1, rect.getArcWidth(), rect.getArcHeight())); } else { g.draw(shape); } }
private void drawBorder(Graphics2D g, Shape shape, int width, int height) { Paint p = getBorderPaint(); if(isPaintStretched()) { p = calculateSnappedPaint(p, width, height); } g.setPaint(p); g.setStroke(new BasicStroke(getBorderWidth())); // shrink the border by 1 px if(shape instanceof Rectangle2D) { Rectangle2D rect = (Rectangle2D) shape; g.draw(new Rectangle2D.Double(rect.getX(), rect.getY(), rect.getWidth()-1, rect.getHeight()-1)); } else if(shape instanceof RoundRectangle2D) { RoundRectangle2D rect = (RoundRectangle2D) shape; g.draw(new RoundRectangle2D.Double(rect.getX(), rect.getY(), rect.getWidth()-1, rect.getHeight()-1, rect.getArcWidth(), rect.getArcHeight())); } else { g.draw(shape); } }
private void drawBorder(Graphics2D g, RectangularShape shape, int width, int height) { Paint p = getBorderPaint(); if(isPaintStretched()) { p = calculateSnappedPaint(p, width, height); } g.setPaint(p); g.setStroke(new BasicStroke(getBorderWidth())); // shrink the border by 1 px if(shape instanceof Rectangle2D) { g.draw(new Rectangle2D.Double(shape.getX(), shape.getY(), shape.getWidth()-1, shape.getHeight()-1)); } else if(shape instanceof RoundRectangle2D) { g.draw(new RoundRectangle2D.Double(shape.getX(), shape.getY(), shape.getWidth()-1, shape.getHeight()-1, ((RoundRectangle2D)shape).getArcWidth(), ((RoundRectangle2D)shape).getArcHeight())); } else { g.draw(shape); } }