protected void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); final int w = getWidth(); final int h = getHeight(); if (callFocus) { requestFocus(); callFocus = false; } // RenderingHints renderHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, // RenderingHints.VALUE_ANTIALIAS_ON); // renderHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); // renderHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, // RenderingHints.VALUE_TEXT_ANTIALIAS_ON); // g2d.setRenderingHints(renderHints); g2d.setColor(Color.white); g2d.fillRoundRect(0, 0, w, h, 11, 11); if (borderColor != null) { g2d.setColor(borderColor); g2d.drawRoundRect(0, 0, w - 1, h - 1, 11 - 1, 11 - 1); } super.paintComponent(g); }
@Override protected void paintComponent(Graphics g) { Graphics2D gd = (Graphics2D) g.create(); shape = new RoundRectangle2D.Double(0, 0, getWidth(), getHeight(), getHeight(), getWidth()); if (isFokus()) { setForeground(Color.RED); paint = new GradientPaint(0, 0, Color.YELLOW, getWidth(), 0, Color.YELLOW); } else { setForeground(Color.BLACK); paint = new GradientPaint(0, 0, Color.white, getWidth(), 0, Color.white); } gd.setPaint(paint); gd.fill(shape); super.paintComponent(g); glass = new GradientPaint( 0, 0, new Color(1F, 1F, 1F, 0.5F), 0, getHeight(), new Color(1F, 1F, 1F, 0F)); gd.setPaint(glass); gd.fill(shape); gd.dispose(); }