On Jul 10, 2005, at 11:34 PM, Joshua Marinacci wrote:
Hi Tim.
I wasn't aware that you could have a lightweight popup at all. All of
my experiments had always resulted in heavyweights. That's why we
showed certain hacks during our 'Swing Hacks' presentation at JavaOne
only on Windows. The fake-transparent window hack, in particular. It
would run just fine on OSX, but you'd see this ghost shadow below it.
Since there was no clear workaround (or at least one that would fit
into the presentation) we just switched to XP in VPC. (Well, the book
is all about hacks, so why not hack a workaround into our
presentation! :)
You said that you saw a comment in the code. Is the source to Apple's
implementation available? I'd love to see it!
There was a src.zip I got from Apple at the time. It looked like
they'd just hacked the implementation of PopupFactory a bit. I know
because, embarassingly, I filed a bug parade bug about it only to have
it pointed out to me that it was not actually Sun's code :-)
In answer to your question for a hack to remove the dropshadow I have
an answer for you. It turns out that you can set a translucent color
as the background of a toplevel window. Well, you've always been able
to do that, but on OSX it will actually make the window translucent!
This is completely undocumented, of course, but very cool. Tests
indicate that OSX will draw the shadow in proportion to the opaqueness
of the window. If you set the background of your JFrame to "new
Color(0,0,0,0)" it will make the background transparent and remove the
dropshadow. The title of the frame and the resize control will still
have shadows though (very odd). To fix this I've used a JWindow
instead of a JFrame, which removes the title and resize control.
Depending on your needs this may do what you want. Since you probably
don't want your actual floating component to be transparent you can
always draw a non-transparent component over it.
I discovered that you could do that with windows last week - was
playing with reimplementing NetBeans' window system using undecorated
frames and such, trying to see just how coolly mac-like a UI I could
slap on NetBeans with some egregious hacks. I even noticed the lack of
a drop shadow, but I hadn't thought about that technique here - good
catch!
I originally had this feature in the book, but it was cut at the last
minute during some re-organization. I wish it had made it in because
I've discovered how useful it is since our final draft went in. I've
used it for splashscreens and other popups.
I was particularly impressed that such non-rectangular windows actually
don't respond to mouse clicks on fully transparent portions, so you
have, for all intents and purposes, a really non-rectangular window in
java that behaves like one (now whether the technique continues to work
in the future, that's the question :-)
BTW, Tim. It was great to meet you at the O'Reilly get together before
JavaOne. We need to get together again some time.
Agreed!
-Tim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden