JPanel+Image

Hi,

I want to display a graph (image) in a Jpanel. How can I dynamically set a new graph as users press startButton.

if(evt.getSource().equals(startButton)){

addImage(jPanel4,img);

getContentPane().add(jPanel4);

jPanel4.setBounds(340, 180, 322, 250);

jPanel4.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));}

For this code: it correclty displays the image, but pressing the startButton twice, e.g. during certain run did not display a new figure (it should do becuase my program gives different results each time the user presses StartButton). However, if I run the program again (by closing and running) it will disply it correctly.

[784 byte] By [MoonSpotLighta] at [2007-11-27 2:29:21]
# 1
i think you're in the wrong place here, better go to http://forum.java.sun.com/forum.jspa?forumID=57.you might find an answer therethomas
kloebera at 2007-7-12 2:42:28 > top of Java-index,Java Essentials,Java Programming...
# 2
Thanks..
MoonSpotLighta at 2007-7-12 2:42:28 > top of Java-index,Java Essentials,Java Programming...