Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


[java] update() isn't called ?

This topic is 5419 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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) {	
		//bufImgG2D is the Graphics2D from the BufferedImage - bufImgSurface

		bufImgG2D.setColor(new Color(0,255,0));


		//bufImgSurface - BufferedImage

	public void paintComponent(Graphics 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]

Share this post

Link to post
Share on other sites
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?

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!