Hi,
I have a problem repainting Jpanel. I wrote a simple code just to check whether it works, but notnihg is happening. Function initPanelAnswer should initialize answer panel with some image, but I wanted to make it more simply. So, according to my logic, this should print out "Paint Component", after I create instance of this class somewhere else. Where am I wrong?
Thanks,
Vuchko
public class PanelAnswer extends JPanel {
private JPanel answer;
public PanelAnswer(){
answer = new JPanel();
initPanelAnswer();
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
System.out.println("Paint Component");
}
private void initPanelAnswer(){
repaint();
}
public JPanel getPanel(){
return answer;
}
}