Solved

doublt abt panels

Posted on 2003-12-05
4
324 Views
Last Modified: 2010-05-18
hi there

i have some problem n hope u ppl cud guide me

wut  iam trying to do is

my application has a frame and on to tht frame there is a panel of same size as tht of from and on that panel iam i am plotting some images(ImageIcon)

firstly wut i wanted tht i should be able to add a popupmenu on the image on right click on that image
but as it's not a component so it's not possible

so wut i did firstly i added a panel of same size as that of image at a specified location into main panel and then i added the image at the same location into the main panel ok

so now i can add the Mouse Events so a pop up is displayed on the right click


the problem part is tht i want tht when i left click on the (image+panel) then tht should be shown selected same as it happens when we click on the Desktop icons etc


how can we do this
if didnt get the question then ask for clarification
pls try to help
thanxx
0
Comment
Question by:starter79
4 Comments
 
LVL 4

Expert Comment

by:vk33
ID: 9881460
You can set the border of the panel, containing your Image:

panel.addMouseListener(new MouseInputAdapter() {
   mouseClicked(MouseEvent e) {
      if (e.getButton() == MouseEvent.BUTTON1) {
         JComponent source = (JComponent)e.getComponent();
         source.setBorder(new LineBorder(Color.BLACK));
      }
   }
}

Regards!
0
 
LVL 92

Accepted Solution

by:
objects earned 30 total points
ID: 9884907
> but as it's not a component so it's not possible

anything (in your app) you can click on is a component.
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
eclipse package explorer vs project explorer view 2 129
how do i compare an object based on two fields 6 53
hibernate example using maven 12 42
Problem to Alipay 10 22
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
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.

770 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