aspose file tools*
The moose likes Beginning Java and the fly likes Image Click Event Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Image Click Event" Watch "Image Click Event" New topic
Author

Image Click Event

Angela Jessi
Ranch Hand

Joined: Nov 27, 2000
Posts: 428
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

Joined: Sep 29, 2000
Posts: 8521
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).]


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Image Click Event