Duvida com JPanel Paint

0 respostas
jonasjgs2

bom dia a todos...
fiz um jpanel e coloquei o seguinte nele

private GradientPaint gradient = null;

    @Override
    public void paint(Graphics g) {
        Graphics2D g2 = (Graphics2D) g;
        if (gradient == null) {
            gradient = new GradientPaint(0, 0, Color.BLACK,
                    300, 100, Color.LIGHT_GRAY);
        }
        g2.setPaint(gradient);
        g2.fill(new Rectangle2D.Double(0, 0, this.getWidth(), this.getHeight()));
    }

    public void setGradientPaint(GradientPaint gradient) {
        this.gradient = gradient;
    }

ou seja coloquei um gradiente nele...
ate ai blz ele funciona normalmente

porem se eu colocar um JButton
o Jbuton não aparece perfeito... e as vezes ate desaparece
alguém pode me explicar como eu posso resolver este problema
desde já agradeço

Criado 27 de março de 2014
Respostas 0
Participantes 1