Problem with JApplet painting
I have an applet with some few lightweight(Swing) components on it.
When I run it, the components dose not appear until I pointing on them with the mouse.
Code:
public class test extends JApplet implements Runnable{
JButton btn;
JTextField txt;
JLabel lbl;
public void init(){
this.setSize(300, 300);
this.setLayout(new FlowLayout(1,0,0));
btn = new JButton("");
btn.setPreferredSize(new Dimension(50,10));
txt = new JTextField("");
txt.setPreferredSize(new Dimension(50,10));
lbl = new JLabel("Test");
lbl.setPreferredSize(new Dimension(50,10));
add(btn);
add(txt);
add(lbl);
}
public void run(){
}
public void paint(Graphics g){
}
}
When I delete the paint methode, the components are presenting fine.
What is the problem?
:) sorry for the bad english