/** * Draws the shape. * * @param g2d 2D Graphics object. * @param w width of the button * @param h height of the Button */ private void drawShape(Graphics2D g2d, int w, int h) { color = ColorUtils.getInStance().getGradientColor(this.colorTheme, getHeight(), null); if (shapeType.equals(ShapeType.ROUNDED_RECTANGULAR)) { g2d.setPaint(color); g2d.fillRoundRect(0, 0, w, h, 10, 10); g2d.setPaint(new Color(100, 100, 100, 100)); g2d.drawRoundRect(0, 0, w - 1, h - 1, 10, 10); g2d.setPaint(new Color(255, 255, 255, 50)); g2d.drawRoundRect(1, 1, w - 3, h - 3, 10, 10); } else if (shapeType.equals(ShapeType.RECTANGULAR)) { g2d.setPaint(color); g2d.fillRect(1, 1, w - 2, h - 2); g2d.setPaint(new Color(100, 100, 100, 100)); g2d.drawRect(0, 0, w - 1, h - 1); } else if (shapeType.equals(ShapeType.OVAL)) { g2d.setPaint(color); g2d.fillOval(1, 1, w - 20, h - 2); g2d.setPaint(new Color(100, 100, 100, 100)); g2d.drawOval(0, 0, w - 20, h - 1); } else if (shapeType.equals(ShapeType.ELLIPSE)) { g2d.setPaint(color); Shape shape = new Ellipse2D.Double(1, 1, w - 2, h - 2); g2d.fill(shape); g2d.setPaint(new Color(100, 100, 100, 100)); shape = new Ellipse2D.Double(0, 0, w - 1, h - 1); g2d.draw(shape); } else if (shapeType.equals(ShapeType.CIRCULAR)) { int size = Math.min(getWidth(), getHeight() - 2); g2d.setPaint(color); g2d.fillOval(2, 2, (size - 2 * 2), (size - 2 * 2)); g2d.setStroke(new BasicStroke(2)); g2d.setColor(new Color(100, 100, 100, 100)); g2d.drawOval(2, 2, (size - 2 * 2), (size - 2 * 2)); } else if (shapeType.equals(ShapeType.ROUNDED)) { g2d.setPaint(color); g2d.fillRoundRect(1, 1, w - 2, h - 2, h - 5, h - 5); g2d.setPaint(new Color(100, 100, 100, 100)); g2d.drawRoundRect(0, 0, w - 1, h - 1, h - 3, h - 3); } else {; // nothing to do } }