Solved

mouselistener for images

Posted on 2003-12-01
8
288 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Python Assistance 7 36
JAVA part two 5 41
unix in java example 9 43
eclipse package explorer vs project explorer view 2 33
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
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…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to implement Singleton Design Pattern in Java.

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now