Olá estou querendo fazer o JPanel Gradient e estou utilizando o NetBeans 6.0. primeiro eu selecionei o JPanel e fui em Properties -> Code -> Custom Creation Code e lá adicionei o seguinte código
new JPanel(){
public void paintComponent(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
GradientPaint gradient = new GradientPaint(0, 0, Color.GRAY,500,500
, Color.WHITE,false);
g2d.setPaint(gradient);
g.fillRect(0, 0, this.getWidth(), this.getHeight());
}
};
Só que quando eu compilo da erro dizendo que ele não está Achando o JPanel