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

Image Click Event

 
Angela Jessi
Ranch Hand
Posts: 428
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is it possible to have image click event with the use of JDK1.1.7B? Like they have button click or mouse click for the buttons.
Is anybody has demo simple applet or code?
Thanks
Angela
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create a canvas whatever size that you want it and have your image occupy the entire canvas. Canvas has no border or anything, so it will just look like your image. Since Canvas is a Component you can addMouseListener() and detect clicks etc.
You will have to size the canvas depending on what LayoutManager the enclosing container has.
When you sub-class Canvas, you will need to put the image on it in its paint() method.
----------------------------
Cindy Glass
Co-author of Java 2 Certification Passport

[This message has been edited by Cindy Glass (edited November 05, 2001).]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic