File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Canvas

 
colton peterson
Ranch Hand
Posts: 97
Linux Python VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do you use Canvas. I understand that you need a Graphics object, but I'm not sure how to get one of those as I am pretty sure you can't say

Graphics g = new Graphics();
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the Java API documentation for Canvas and search for "Graphics".
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
let's slide this over to a more graphically oriented forum...
 
Campbell Ritchie
Sheriff
Pie
Posts: 47263
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought most people used JPanel for painting on nowadays.

Go and look through the API for Canvas and you find it has a paint method.
You will have to extend Canvas and override the paint method, something like this:-At least I think you do; I have never tried. The bit about super.paint clears the Canvas so you start on a blank screen.
 
colton peterson
Ranch Hand
Posts: 97
Linux Python VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks
 
Campbell Ritchie
Sheriff
Pie
Posts: 47263
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by colton peterson:
thanks
You're welcome
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic