JDK-4416305 : RFE: Allow AWT peers to be always "on top".
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2001-02-16
  • Updated: 2002-06-21
  • Resolved: 2001-02-16
Related Reports
Duplicate :  
Description

Name: yyT116575			Date: 02/16/2001


java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

I would like to create a JWindow, which remains always on top of the other
windows/frames in my application. You could imagine a window like the toolbars
of products running on Windows like MS Office or Adobe PhotoShop, which
1. when dragged out of the main frame stay always visible and in front of the
application's main frame and
2. don't grab the focus until the user wants it.

More detail explanation:

In the following text when I write "window", please understand it as
"JFrame", "JWindow", "JDialog", even the AWT- "Frame", "Window" and
"Dialog". 

But I need to implement a toolbar, which the user can drag out of the main
window and drop somewhere on the desktop. In the windows environment all
applications with floating toolbars allow this. Further they allow the user
to move his main window around and to have the toolbar still visible on top
of it.

So, if I use JInternalFrames, I can get the behavior until the user wants to
drag the toolbar out of the main window. I can implement a toolbar like the
JToolBar to have full control over what the uesr is doing. But when the user
drops the toolbar somewhere out of the main window, the only possibility for
now is to create a new JWindow or JFrame or Window or Frame and put the
toolbar there (This is actually what the L&F-dependent subclasses of
ToolBarUI do.) The problem is that the new created window is not always "on
top" of the main window, but only when they are not overlapping.

In my RFE I've written, that the behavior should be implemented for
AWT-peers, not because I don't like Swing, but because I think this is
conceptually the cleanest (and may be the easiest - there should be only one
flag which is translated in a native function call) way to do it.

Another posibility would be to implement for the toolbar window a
WindowDeactivateListener which activates the window again and trasferres all
AWT events to it's parent (the main window)...

The behavior I describe is very natural for every Windows- (and I think also
Mac- and Linux-)user, and my users expect it also.

I could implement it using native calls, but I think, I'm not the only one
needing multiple toolbars which are always visible in a platform independent
way. As a reference here are a couple of products with such toolbars:
all MS Office applications (Word, Excel etc.), all Corel (Draw, Paint etc.)
Applications, all Adobe applications (PhotoShop, InDesign etc), Netscape
Navigator (Multiple floating toolbars is also an issue not adressed by Swing, 
but we were happy to see the problem solved...:)
(Review ID: 117030) 
======================================================================