I'm totaly new to java, but I have been writing a bit in other langages. So my app is generating a .png file representing the structure of graph. This it already made, and it's working fine.I'm generating a .png every time graph's structure is changing(for example when user is adding new node or edge). But I have problem with showing this .png file. I'm doing it like this:

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
Icon icon = new ImageIcon("graph.png");

and if there where no image before it's displaying it ok. but after that, it's still displaying the old image, even when the file graph.png has already changed. do have any idea how to solve this problem ??

You probably need to flush the Image resources. Try adding this to see if it gets rid of the cached image

ImageIcon oldIcon = (ImageIcon)jLabel3.getIcon();
Icon icon = new ImageIcon("graph.png");

Is there a reason that it has to generate a .png instead of rendering directly to the screen?

That's exactly what i've been looking for... I still can't bealive it was so simple :P Thanks a lot!!!
I have to use these .png coz I'm using outer program go generate them.