Mailing Lists: Apple Mailing Lists

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

Text Fields in Palettes was: Re: distributing menu bars accross windows ...



Hi Jerry,

As a proof of concept the following works:

        JTextField aTextField = new JTextField("Almost Solved!");
        aTextField.addMouseListener(new MouseAdapter() {

public void mouseEntered(MouseEvent e) {
((JWindow)((JComponent) e.getComponent ()).getTopLevelAncestor()).setFocusableWindowState(true);
}


public void mouseExited(MouseEvent e) {
((JWindow)((JComponent) e.getComponent ()).getTopLevelAncestor()).setFocusableWindowState(false);
}
});


Of course, this is a bad implementation as it depends on the pointer remaining in the area of aTextField, which is a bit annoying. It should be implemented with a mouse clicked event that then sets the focusable window state to true and places the caret in aTextField (if it doesn't do the latter then another click is required that is also very annoying). Then when aTextField loses focus(?) the focusable window state should be set back to false.

I'd have done this but it's getting late here and my event handling knowledge is a bit shaky!

Try the bad implementation first to check it works for you.

hope this helps.

Ian Cheyne

On 27 Aug 2006, at 18:26, Jerry wrote:


On 27 Aug 2006, at 15:46, Werner Randelshofer wrote:

IMO, in an MDI application, only the outer frame should have a menu bar, document windows shouldn't have one.
I think it is okay, if palette windows have a menu button, but they shouldn't have a menu bar.


Thinking about palettes: The framework does not handle them in a platform independent way. Only DefaultOSXApplication supports them. Maybe, I should add a Palette interface or something to it.

Also thinking about palettes: If you're using the screen menu bar and you have floating palettes implemented as JDialogs of a JFrame that has the global menu bar, there's a problem with keyboard accelerators: the menu bar works fine with the mouse, but if you press, say, Command-N for "New", the File menu highlights in the normal way but the "New" menu item doesn't fire. If you call setFocusableWindowState(false) on the palettes, then it works, but then you can't have any text fields in your palettes.I imagine this is a bug in focus handling for the screen menu bar. Does anyone know of a workround which allows you to have floating palettes with text fields and a menu bar which works properly?


Jerry
_______________________________________________
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: 
 >distributing menu bars accross windows ... (From: Sciss <email@hidden>)
 >Re: distributing menu bars accross windows ... (From: Werner Randelshofer <email@hidden>)
 >Re: distributing menu bars accross windows ... (From: Sciss <email@hidden>)
 >Re: distributing menu bars accross windows ... (From: Werner Randelshofer <email@hidden>)
 >Re: distributing menu bars accross windows ... (From: Jerry <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.