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: Translucent Frames and moving windows



Hi Doug, Florijan and Greg,

Have been poorly lately hence this late response. Thanks for your input on the Translucent Frames. I am convinced that what I was considering was going down a blind alley. I had previously implemented a MouseListener that worked with my own palette title bar and that works well so I will stick with that for the moment. I was considering a translucent JFrame for an Info Palette but will resist that for now - introduces too many complications

I'll have a look at the Metal PLAF code to see what I can do for a cross platform solution with regard to getting a nice palette window decoration.

Have checked out the J2SE6 preview release notes - thanks for that too.

Best Regards,

Ian Cheyne


On 30 Nov 2006, at 21:36, Doug Zwick wrote:

Ian Cheyne wrote:


Am I going down a blind alley?

I played around with this a while back, for dragging a translucent undecorated window. It appears to be Mac-only behaviour. I do not recall trying it on the Mac under Metal, however Windows, Solaris and Linux did not allow dragging the window. The other platforms did not allow the window to be made transparent that way, either. The Cocoa NSWindow class has a selector for enabling this behaviour. If you want this behaviour on the Mac platform, accessing this selector via JNI and JAWT will free you from depending on undocumented behaviour in the JVM (and don't forget to shift the call onto the AppKit thread). I needed cross-platform support, and wound up implementing my own drag-anywhere window in pure Java. Performance was jerky on low-performance CPUs, and some early X11 J2SE5 JVMs would wind up looping on the mouse-move event (causing the window to run off-screen in very short order -- the bug was fixed in a later JVM), but it worked reasonably well.


The Metal PLAF has code to provide software window decorations. This includes a pure-Java title bar and window drag implementation. See the JavaDoc for JFrame.setDefaultLookAndFeelDecorated (or the same method in JDialog), JRootPane.setWindowDecorationStyle and LookAndFeel.getSupportsWindowDecorations. Work through the Sun source code for examples of how they implemented the window drag. Note that the Aqua PLAF does not support these software window decorations, but you can use the Metal code as an example of how to do it yourself, and provide an example to benchmark the performance of your code against.

There may also be things of interest to you in the J2SE6 preview -- read the release notes on the ADC downloads site. More than that cannot be said on this list due to the NDA.


_______________________________________________ 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


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.