JButton with gradient:
Title is self-explanatory. I'm using jforms for this. I only want to edit the jbuttons of my existing jform. I also used this video as a guide
private Color color1 Color.decode("#32162C");
private Color color2 Color.decode("#824678");
private Color color3 Color.decode("#A96CE6");
//these 3 lines errors for me`
private void paintComponent (Graphics grphcs){
int width = getWidth();
int height = getHeight();
BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
//the video used Graphics2d but mine errors
Graphics g2 = img.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
//setRenderingHint errors for me ("cannot find symbol")
//GRADIENT COLOR
GradientPaint gra = new GradientPaint(0, 0, color1, width,0,color2, 0, color3);
//GradientPaint line errors for me ("no suitable constructor found)
g2.setPaint(gra);
//setPaint errors for me
g2.fillRoundRect(0,0, width, height, height, height);
grphcs.drawImage(img, width, width, null);
super.paintComponents(grphcs);
}
