posted 19 years ago
Hello,
I have the following problem:
A JPanel with overwritten paint method works fine when it is placed directly on the content pane. However when it is placed on another JPanel which is located at the content pane, the paint is called but nothing is visible.
Does anyone have an idea?
to clearify the code:
public class ProfileApplet extends JApplet{
private TestPanel testPanel = new TestPanel();
public void init(){
/*this works fine*/
//getContentPane().add(testPanel);
/*this doesn't*/
JPanel panel = new JPanel();
panel.add(testPanel);
getContentPane().add(panel);
}
}
public class TestPanel extends JPanel{
public void paint(Graphics g){
g.drawLine(10, 10, 20, 20);
}
}
thanks!