🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: How does one ensure that transparent JLabel is displayed over top another JLabel

#1100
From: John McGrath [TeamB]
Date: Thu, 25 Mar 2004 23:18
42 lines
2589 bytes
On 3/25/2004 at 6:05:21 PM, Ted Byers wrote:

> > I think I understood the part about event handling, but what is
> > wrong with the way that they display?
> > 
> For the invisible one, the mouse cursor is supposed to change to a
> hand.

OK, but that is not display.  I take it they are being displayed
correctly?

> I used the xylayout manager.  I put the label to hold the image
> first.  I had to.  The second had to be placed relative to features
> in the image.  Yes, the labels overlap.  

Then you have to make sure that the "hotspot" label is in front.  You
should be able to do that with a right-click / "bring to front" in the
UI Designer.

> The odd thing is that the mouse click event is being handled exactly
> as I expected and where, on the image, I expected.  So I really don't
> understand why the cursor is not being change back and forth between
> the hand and the default pointer as the mouse enters and exists 

Mouse events go the the top-most component that has a mouse listener,
so they get through to the hotspot label even if it is underneath.  I
do not think that is the case for cursors.

> the area covered by the invisible label.

You might find it easier to work with at first by setting a border on
the invisible JLabel, which will make it easier to see.  You can remove
the border when once you get things working.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <406368d1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <40611e78$1@newsgroups.borland.com> <40635f50$1@newsgroups.borland.com> <406364a2$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,996c15d51938f6ca
X-Google-Attributes: gid111d45,public
X-Google-ArrivalTime: 2004-03-25 15:27:01 PST
From: "John McGrath  [TeamB]" <ng-b@JPMcGrath.net>
Subject: Re: How does one ensure that transparent JLabel is displayed over top another JLabel
Newsgroups: borland.public.jbuilder.java.swing
References: <40611e78$1@newsgroups.borland.com> <40635f50$1@newsgroups.borland.com> <406364a2$1@newsgroups.borland.com>
User-Agent: XanaNews/1.16.1.11
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-15
NNTP-Posting-Host: 151.197.242.55
Message-ID: <406368d1@newsgroups.borland.com>
Date: 25 Mar 2004 15:18:41 -0800
X-Trace: newsgroups.borland.com 1080256721 151.197.242.55 (25 Mar 2004 15:18:41 -0800)
Lines: 42
X-Authenticated-User: jpmcgrath
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail