Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disabling drop shadow on JWindows?



Hi Tim,

There's no clean way to get a Cocoa-Java NSWindow that corresponds to the one you want, but you can write a very light JAWT library that will give you the NSView/Window corresponding to your popup and then call setHasShadow:NO.  Other developers have done this in the past, however, because of how JAWT works the call won't work until the component is first shown.  That means there will be a slight flicker as the shadow appears for the split second before your setHasShadow call goes through.

----------------------------------------------

Matt Drance

DTS Engineer

Java - Dashboard - Address Book

email@hidden



On Jul 10, 2005, at 11:06 PM, Tim Boudreau wrote:


On Jul 10, 2005, at 6:14 PM, Scott Palmer wrote:



On 10-Jul-05, at 3:13 AM, Tim Boudreau wrote:


It's compounded a bit by the fact that Apple's implementation of PopupFactory doesn't seem to get the algorithm for deciding when to use a heavyweight window quite right - sometimes, apparently randomly, it will use a heavyweight window even though a lightweight popup would work just fine.


I think heavyweights are used for two reasons.  One to get the shadow, two to get the translucent effect that pop-ups/menus have on OS X.  I wasn't sure if lightweight pop-ups were ever used.


In an earlier 1.4.2 release on Mac OS, heavyweight popups were always on - the ivar in PopupFactory was hardcoded to the heavyweight constant, with a note in the sources about "Steve will fix this...";  in a later release this was fixed, but lightweight popups were broken (I had to put a mac-os version-specific hack into some code in NetBeans that uses PopupFactory to *force* the popups to be heavyweight).  In the latest version, you sometimes get heavyweight popups, sometimes lightweight popups; it doesn't seem to be solely determined by whether a lightweight popup could be used - sometimes you get one, sometimes you don't.  I haven't read the sources for the latest version of PopupFactory, but I'm guessing it's just reusing a heavyweight popup if it has a recently used one that hasn't been GC'd or something such.

Anyway, since the drop shadow is provided by the OS for the native window, my best bet is to implement my own PopupFactory which will do lightweight popups where possible - that's not hard.  But heavyweight popups will still sometimes be needed - I just need them without the drop shadow border.  I'm not above reflection-based hacks on the window peer if that's what it takes - it's easy enough to make them fail gracefully.

Does anyone know a way to turn off the drop shadow for a native window via Cocoa Java (yes, I know, bad bad bad, don't do that) or a less egregious client property or something that will do the trick?

-Tim

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


 _______________________________________________
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

This email sent to email@hidden

References: 
 >Disabling drop shadow on JWindows? (From: Tim Boudreau <email@hidden>)
 >Re: Disabling drop shadow on JWindows? (From: Scott Palmer <email@hidden>)
 >Re: Disabling drop shadow on JWindows? (From: Tim Boudreau <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.