Solved

mouselistener for images

Posted on 2003-12-01
8
315 Views
Last Modified: 2012-06-27
hi there

iwant to set mouse listener for the images
i know as image is not a component its not possbile but is there any other way to do that

basically i want to add a popup menu to the image when a image is right clicked a popup should be displayed

thanx
0
Comment
Question by:starter79
  • 4
  • 2
8 Comments
 
LVL 92

Expert Comment

by:objects
ID: 9856281
If you are using Swing then use a JLabel with an image icon.
0
 
LVL 92

Expert Comment

by:objects
ID: 9856284
for awt create component subclass that displays your image and add your mouse listener to that component.
0
 

Author Comment

by:starter79
ID: 9856399
thanx objects

actually wut iam doing is tht iam using some other API ok
it's bbn's  openmap application

in that they have there own methods to plot an image on the screen (map) and tht too using Lat Lon

so in tht case i can only plot an instance of ImageIcon class
i havent seen any mehtod tht plots the component

can u guide some other way pls
i know it's tricky or may be difficult also
but then also i have to do it anyhow
thanx for taknig interest
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 92

Expert Comment

by:objects
ID: 9856412
hard to see without knowing the api u are using.
What can you add a mouse listener to?
0
 

Author Comment

by:starter79
ID: 9856733
i can add mouse listeners only to the components but iam plotting a ImageIcon
0
 
LVL 92

Accepted Solution

by:
objects earned 40 total points
ID: 9861973
Then simply have your componant paint the ImageIcon. JLabel already supports this.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
diffSum example 4 52
maven module vs maven project 3 47
Running JavaFX on JDeveloper 12C 1 55
Java class and jar 3 25
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question