This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Image Click Event