   [java] update() isn't called ?
  Hey guys...I have a problem with my "public void update(Graphics g)" function not beeing called, but the paint / paintComponent functions are beeing called with once :/ public void update(Graphics g) {JOptionPane.showMessageDialog(null,"WORKS!");//bufImgG2D is the Graphics2D from the BufferedImage - bufImgSurfacebufImgG2D.setColor(new Color(0,255,0));bufImgG2D.fillRect(0,0,200,200);paintComponent(g);//bufImgSurface - BufferedImageg.drawImage(bufImgSurface,0,0,this);}public void paintComponent(Graphics g) {super.paintComponent(g);}Now, that is how the functions look in "class myDrawTestClass" look...The super.paitComponent(g), works just fine... since the JPanel/Panel area is uppdated.The drawing works fine if I move the fillRect and drawImage and setColor to paintComponent function.Besides... I'm not getting any messagebox The DemoApplicatione extends JFrame. But what I know the JFrame is derived from Frame... which is derived from Component?So the update() function should be called shouldn't it??Thx for the help [edited by - bilsa on February 7, 2004 3:23:07 PM]
  Could it be that the repaint() function doesn''t call the update() function on JPanel/Panel objects?That would make sense, since they shouldn''t need to be cleared before painting - since the Frame containing the Panel should have already cleared the screen with it''s update() function?I tried to override the update() function in the class that "extends JFrame", and that update() function is indeed called...Seems like it is this way?;  I''m not sure, but to make sure that the object is cleared before paint is called, try setOpaque( true );, this is just going on what bilsa said. 