Solved

mouselistener for images

Posted on 2003-12-01
8
324 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
going to wrong jsp page 2 71
Is Applet the way to go for my drag and drop system? 8 51
java mysql insert application 14 68
Setup GlassFish 4 57
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
In this post we will learn different types of Android Layout and some basics of an Android App.
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 covers a step-by-step guide to install VisualVM launcher in eclipse.

710 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