Bug 847

Summary: Overlaying Swing components atop GLJPanel not working on Mac OS Java 7
Product: [JogAmp] Jogl Reporter: Michael Bayne <org.jogamp>
Component: macosxAssignee: Sven Gothel <sgothel>
Severity: enhancement    
Priority: ---    
Version: 2   
Hardware: All   
OS: all   
Type: --- SCM Refs:
Workaround: ---
Attachments: Test program showing bug

Description Michael Bayne 2013-10-04 01:37:12 CEST
Created attachment 507 [details]
Test program showing bug

GLJPanel is supposed to allow JOGL to coexist with Swing UIs, but if we try to overlay a Swing component atop the GLJPanel, the Swing component is not refreshed when the GLJPanel is redrawn.

Overlaying a heavyweight component does work, so that's a viable workaround.

I've attached a simple program that shows the overlay of a Button and a JButton atop a GLJPanel. If you click the JButton (causing it to be redrawn) you'll see it flash into existence for a frame, until it's overwritten again on the next frame by GLJPanel.

My use case is overlaying native Java text fields atop a JOGL view to allow sophisticated text entry into an otherwise GL-based app without having to reimplement the extremely complex universe of text entry methods. Presumably this would also cause problems with a Swing popup menu that overlapped a JOGL view.
Comment 1 Sven Gothel 2013-10-05 14:50:33 CEST
Similar experience w/ TestTiledPrintingGearsSwingAWT2 when using 
[1 ]   anim == true ; layered == true ; layout == false, while
[2 ]   anim == any  ; layered == true ; layout == true works fine (LayeredPane), as well as
[1']   anim == false; layered == true ; layout == false, while

So in [1] the animation (display) sort of renders the top jbutton invisible.

I am unsure whether this is a bug or a feature, 
i.e. whether we are required to force the Animator driven display to update the top-level jbutton
as well .. or if users shall use LayeredPane. I guess the latter is true (-> [2]).

If you disagree .. please reopen and provide [an idea to] a remedy.
Comment 2 Michael Bayne 2013-10-10 20:34:27 CEST
Ah, OK. I was adding the GLJPanel to the RootPane and then my overlay to the JLayeredPane, but if I add them both to the JLayeredPane it works. Thanks!