aspose file tools*
The moose likes Swing / AWT / SWT 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 » Swing / AWT / SWT
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,
I have an applet in which I have one Image. I want to do this:
If somebody click images, I want to call another HTML page from the server with the use of URL method.
MY QUESTION:
Please LET ME KNOW IS THERE IMAGE CLICK EVENT(LIKE WE HAVE BUTTON CLICK)?? If not, is there any other alternative for image click ??
Thanks,
Angela
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Angela,
It's called MouseClicked. I assume you have drawn your image into the applet or into a panel. Add a mouse listener to your applet or panel. In the method (mouseClicked) you can get the x and y locations which where clicked. Compare that to the image location + image width and heights to figure out if the clicked happened on the image or not.
Regards,
Manfred.
Angela Jessi
Ranch Hand

Joined: Nov 27, 2000
Posts: 428
Thanks Manfred,
Angela

Originally posted by Manfred Leonhardt:
Hi Angela,
It's called MouseClicked. I assume you have drawn your image into the applet or into a panel. Add a mouse listener to your applet or panel. In the method (mouseClicked) you can get the x and y locations which where clicked. Compare that to the image location + image width and heights to figure out if the clicked happened on the image or not.
Regards,
Manfred.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Image Click Event
 
Similar Threads
change images in Java Applet
Can I have listener on the table header?
Customized chekclist list view
Disable an image anchor
Handling the Event of the Image