473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Pass MouseEvent to underlying layer

9
Basically I have the following problem:
I have a JLayeredPanel with two JPanels on it. The smaller one is on top of a larger one and both handle their own mouseevents. However, when I click in the bounding box of the smaller JPanel on top I want the click to register on the lower JPanel also as if the top JPanel weren't there .
I thought I could solve this by just having the mousePressed-function of the top JPanel call lowerJPanel.mousePressed(event) , and this kind of works, however, I need to know where the user clicked.
The problem now is that event.getPoint() (which is used in lowerJPanel.mousePressed(event)) returns some relative coördinate. Since the event first registered on the top JPanel, I am now passing a MouseEvent variable with a relative location on the top JPanel and NOT on the lower one.
I have already tried tinkering with Component.dispatchEvent and MouseEvent.setSource, but it didn't help.

Here is an image of the problem:



Thanks for any help!
Dec 18 '07 #1
1 1980
Dököll
2,364 Expert 2GB
Basically I have the following problem:
I have a JLayeredPanel with two JPanels on it. The smaller one is on top of a larger one and both handle their own mouseevents. However, when I click in the bounding box of the smaller JPanel on top I want the click to register on the lower JPanel also as if the top JPanel weren't there .
I thought I could solve this by just having the mousePressed-function of the top JPanel call lowerJPanel.mousePressed(event) , and this kind of works, however, I need to know where the user clicked.
The problem now is that event.getPoint() (which is used in lowerJPanel.mousePressed(event)) returns some relative coördinate. Since the event first registered on the top JPanel, I am now passing a MouseEvent variable with a relative location on the top JPanel and NOT on the lower one.
I have already tried tinkering with Component.dispatchEvent and MouseEvent.setSource, but it didn't help.

Here is an image of the problem:



Thanks for any help!
For the time being this is German sounding to me, and I am Carribean, you figure. Please stay tuned for added support on this, Jordi. Might also be helpful if you post your current code for a closer look:-)

In a bit!
Dec 19 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Robert | last post by:
Hi, I was trying Firefox 1.5 beta with my javascript and found out that the following test did no work anymore. if (this.constructor == Event) I think they changed it that this.constructor...
11
by: Robert | last post by:
Hi, My previous thread on this topic was too short on information so I I'll try again. When I tried out Firefox 1.5 beta some of my javascript did not work anymore. Here is some code to...
0
by: Scott R | last post by:
I have a data layer that is set up to pass datasets to and from the presentation layer. In migrating to 2.0, I would like to use the objectdatasource. The problem I am having is that it seems...
1
by: mjhillman | last post by:
I have a web project (ASP.Net/VB.net) with a data access layer class that passes dataset objects to the web form based on a passed SQL query. I tried to reuse this class in a VB.Net Windows form...
0
by: Mythran | last post by:
I have a custom Principal (implements System.Security.Principal.IPrincipal interface) that I need to access from a WebService. My web application has the Thread.CurrentPrincipal set to this new...
13
by: andrea | last post by:
Sorry for the stupid question, I know, but sometimes is necessary starts from the basic. I don't know how to pass the result of a method generated from a DAL class to a BL class returning the...
3
by: deko | last post by:
I have a Solution with 3 Projects, representing 3 layers: App_BL App_DA App_UI All in Namespace APP UI is a Windows Forms app and BL and DA are class libraries.
1
by: fishwater00 | last post by:
I do not know how to express the array I am going to work with, but some codes can describe them. If I define an array and a struct with member : float velocity; MODEL.VELOCITY; VELOCITY in...
0
by: kronus | last post by:
Hi everyone, Yes, I need to use you guys as a sounding board once more :-) I have a button that has two listeners one for mouse up and the other for mouse down and they point to the same...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.