19991008: Focus Policy

>From: Cristy <cristy@xxxxxxxxxxxxxxxxxxxx>
>Organization: .
>Keywords: 199910082333.RAA14941

Hi-

>I have a panel (MAIN) with Swing components on the left and a VisAD 3-D
>surface on the right.  When I map another panel (TEXT) on top and move
>the cursor over the left side of MAIN I get the expected behavior:
>TEXT stays mapped on top of MAIN.  However if I move the cursor right
>into the VisAD window of MAIN, then TEXT moves under MAIN (obscuring TEXT).
>This is disconcerting to the users of my application.  Note, this only
>happens under Win 98/NT.  On Solaris TEXT continues to stay mapped on top of
>MAIN unless I specifically click on the window frame of MAIN.  Does
>anyone have a solution for this problem?  I'm not sure if the problem is
>related to VisAD, Swing, Java3D, or the Win operating system.

This is a problem of mixing lightweight (ie Swing Components) with
heavyweight components (ex: AWT components).  The DisplayImplJ3D.getComponent()
method returns (I believe) an AWT Canvas which is a heavyweight
component.  Heavyweight components will overlay lightweight versions.
The DisplayImplJ2D returns a JPanel which is lightweight.  In previous
discussions of this problem, Bill mentioned that this is a frequent
complaint on the Java3D list.

I ran into this when trying to use Swing InternalFrames and had to
abandon that idea.  So, it is not a VisAD problem per-se, just 
a problem of mixing and matching AWT and Swing components.  There is
a paper on Sun's Swing Connection about this. (I'm at home so don't
have a URL handy).

Note you will also run into this problem if you use Swing menu
components that drop down over 3D panels. For the VisAD spreadsheet,
Curtis got around this by using AWT components for the menus. You could
create AWT Panels instead of JPanels, but that kind of defeats the cross
platform look and feel.

Don
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
*************************************************************
Unidata WWW Server               http://www.unidata.ucar.edu/
McIDAS Demonstration Machine  http://mcdemo.unidata.ucar.edu/
*************************************************************

  • 1999 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: