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: How to imitate iApp floating palette focus behavior



On Feb 27, 2008, at 10:10 AM, Mike Swingler wrote:

> On Feb 27, 2008, at 9:07 AM, Peter Powers wrote:
>
> >     With Leopard, it's much easier to achieve a floating palette using:
> >
> >     	getRootPane().putClientProperty("Window.style", "small");
> >     	setAlwaysOnTop(true);
> >
> > In Apple's iApps that use an 'Inspector', the document (or target) window does not lose focus
> > when the Inspector gains focus. Is there a workaround to imitate this behavior using Java?
>
> Unfortunately no. To emulate this behavior, we will have to do more analysis of where the Java
> concept of focus matches to AppKit's model of the "key" window vs. the "main" window (two very
> different concepts).
>
> This is something we'd like to be able to offer in the future, however it is not possible today.
>
> > Using setWindowFocusableState(false) is unacceptable b/c components requiring KeyboardInputFocus
> > such as TextFields are non-functional, despite all other controls receiving and processing mouse
> > events; it also reduces accessibility.
>
> Naturally.

This topic has shown up on the mailing a few times before and there was some
good discussion about attempted workarounds. One demonstration showed that
something like

public class FloatingPalette
		extends JWindow
{
    setFocusableWindowState (false);

    FloatingPalette (JFrame frame)
    {
        super (frame);
        setFocusableWindowState (false);
    }

    public boolean getFocusableWindowState ( ) { return true; }
}

would result in the parent frame retaining focus but allow you to use
text fields
in the floating window. There may have been some caveats about whether this
worked with all Java versions and/or all platforms, but it worked for me with
Java 1.4 on OS X.

However, this still failed in one critical area. If the focused component was a
text field in the floating window and you entered the keystroke associated with
a menu command, you would see the appropriate item in the menu bar flash,
but the command would otherwise be "swallowed".

rbs

-- 
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



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.