File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HELP!!!! how do i get image by extending Canvas object

 
Richard Teston
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
help...
i have this code i've extended the canvas object, basically i'm coding my own button by using canvas but how do i get image from a file
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Richard,
How about:
Image im = Toolkit.getDefaultToolkit().getImage( "C:\\TEMP\file.gif" );
Regards,
Manfred.
 
Roy Ben Ami
Ranch Hand
Posts: 732
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also, since you are using canvas i guess you are using AWT and not swing.
if u ecide to switch to swing then u can use the class called ImageIcon. only needs a filename in its constructor.
ImageIcon x=new ImageIcon("file name");
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic