🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Adding global mouse listener

#10715
From: Johan Forsberg
Date: Fri, 13 Aug 1999 00:00
22 lines
1589 bytes
Jason Burton <Jason.Burton@McLeodSoftware.com> skrev i
diskussionsgruppsmeddelandet:7opsfj$ala3@forums.borland.com...
> Does anyone know of a way to track mouse events at the application level?
> For example, I want the user to be able to click a "Help" button.  This
> changes their cursor into a question mark.  I want my Help class to then
> listen to mouse events to display context sensitive help the next time the
> mouse is clicked (at which time the Help class will quit listening to
mouse
> events).

A third idea is this...

When you enter 'help mode', add a transparent component (ie. iconless jlabel
without text) to BorderLayout.CENTER of your JFrame's glass pane, and give
it a mouse listener. Since the glass pane is above the normal contents of
the window, the jlabel will get all mouse clicks (except in the menu, but
that's life).

Then use contentFrame.getComponentAt(mousePoint) to find which component was
clicked, and remove the jlabel (perhaps it's enough to remove its mouse
listener?)
Technical Details
Message-ID: <7p0i1d$h8c4@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <7opsfj$ala3@forums.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,2c6fb04c8324bda4
X-Google-Attributes: gid111d45,public
From: "Johan Forsberg" <jfo@SPAM_SPAM_EGGS_SPAMstmf.se>
Subject: Re: Adding global mouse listener
Date: 1999/08/13
Message-ID: <7p0i1d$h8c4@forums.borland.com>
X-Deja-AN: 512173326
References: <7opsfj$ala3@forums.borland.com>
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