Maybe its smart enough to realise that repainting an uninitialised unpopulated invisible panel is unnecessary?
ps: What's the point of answer = new JPanel... don't you want an instance of PanelAnswer?
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
You have a class PanelAnswer with overrides for paintComponent, but you don't do much to create one. I still don't see why you create an unrelated JPanel when you call the constructor for PanelAnswer unless you intend to use it as a container, in which something more like this should work:
public PanelAnswer(){
JFrame jf = new JFrame("Hello");
jf.add(this);
this.add(new JLabel("Hello"));
jf.pack();
jf.setVisible(true);
// initPanelAnswer();
}
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073