Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

updating a canvas  RSS feed

 
Alastair Binner
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to include a canvas on a gui and i want to update it using the update(Graphics g) function.

Can some one explain to me how I call the function because I keep on getting errors of either g is not initialised or Graphics is an abstract class.

Thanks

Al
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the Methods Summary of the Canvas api find the update method and follow the link to the Method Detail section where it explains how the method works and is to be used. From there you can follow the link (under Overrides:) to the update method in the Component class which contains a link to an article Painting in AWT and Swing with more information.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!