Solved

doublt abt panels

Posted on 2003-12-05
4
328 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
[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 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

Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

636 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