Boa tarde pessoal!
Estou fazendo os execcicios do livro da Kathy, quando me deparei com um código que não funcionou.
O objetivo é criar uma tela(GUI) 300 x 300 pixel, e mostra um Button que ao clicar vai gerar uma cor diferente para o circule que encontra-se no centro da Tela.
O Button aparece, mas no centro não aparece a tella.
Gostaria de saber o que está errado com esse código.
[code]import java.awt.;
import javax.swing.;
public class MyDrawPanel extends JPanel{
public void paintComponente(Graphics g){
	g.fillRect(0,0, this.getWidth(), this.getHeight());
	
	int red = 	(int) ( Math.random() * 255 );
	int green = 	(int) ( Math.random() * 255 );
	int blue = 	(int) ( Math.random() * 255 );
	
	Color random = new Color(red, green, blue);
	
	g.setColor(random);
	
	g.fillOval(10,10,100,100);
}
}
[/code]
[code]import javax.swing.;
import java.awt.;
import java.awt.event.*;
public class SimpleGui3c implements ActionListener{
JFrame frame;
public static void main(String[] argss){
	SimpleGui3c gui = new SimpleGui3c();
	
	gui.go();
}
public void go(){
	frame = new JFrame();
	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	
	JButton btn = new JButton("Mudar Cor");
	
	btn.addActionListener(this);
	
	MyDrawPanel dpanel = new MyDrawPanel();
	frame.getContentPane().add(BorderLayout.SOUTH,btn);
	frame.getContentPane().add(BorderLayout.CENTER,dpanel);
	frame.setSize(300,300);
	frame.setVisible(true);
}
	
public void actionPerformed(ActionEvent event){
	frame.repaint();
}
}[/code]
Valeu pessoal!