🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #9135

Re: Catch all Mouseevents in a JPanel

#9135
From: James Cook
Date: Tue, 16 May 2000 00:00
22 lines
1295 bytes
2 ways that I know of, but not knowing precisely what you are trying to do
makes it hard to determine which one is best.

1. Point all of your components to the same mouse handler. I think this
would probably be best.

2. Add a glass pane to your panel and add the mouse listener to this.

jim

Andreas Madenis <madenis@uni-koblenz.de> wrote in message
news:39213273.CEF50D27@uni-koblenz.de...
> I have a JPanel with several components (JButton, JTextField etc.).
>
> I want to catch Mouseevents (esp. Mouseclicks) which happen in any of
> those components. How can I do that? A Mouselistener added to the JPanel
> is only activated when the user clicks on the JPanel itself.
>
> Thanks,
>
> Andreas Madenis
>
Technical Details
Message-ID: <8frgko$2jb4@bornews.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <39213273.CEF50D27@uni-koblenz.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,1313c42d6a159fdf
X-Google-Attributes: gid111d45,public
From: "James Cook" <jimcook.remove.for.spam@iname.com>
Subject: Re: Catch all Mouseevents in a JPanel
Date: 2000/05/16
Message-ID: <8frgko$2jb4@bornews.borland.com>
X-Deja-AN: 624052927
References: <39213273.CEF50D27@uni-koblenz.de>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Organization: Another Netscape Collabra Server User
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.swing