wonders in java
i have 1 JFrame, on that added 2 JPanel. When i click Button on 1st panel it adds Picture to the second panel. But it never displays the picture automatically, while i am restore the JFrame it displays the picture. Even i used repaint() on first panel.
i m wondering, while starting program the paintComponent called automatically. When i try to call repaint() explicitly i never works.
Can any one tell me which i have to repaint (JFrame, 1st panel or second panel)
Regards
Jeyanthi
[514 byte] By [
Jeyanthia] at [2007-11-27 6:17:50]

> have 1 JFrame, on that added 2 JPanel. When i click Button on 1st panel it adds Picture to the second panel. But it never displays the picture automatically, while i am restore the JFrame it displays the picture. Even i used repaint() on first panel.
you need to call repaint on second panel not on first.
>i m wondering, while starting program the paintComponent called automatically.
paintComponent called every gui need to displayed or re-displayed to screen, eg. when your frame show up first or resize.
if you only want to display an image, it will much easier to using image icon instead of overiding a panel.