Bug 847 - Overlaying Swing components atop GLJPanel not working on Mac OS Java 7
Summary: Overlaying Swing components atop GLJPanel not working on Mac OS Java 7
Status: RESOLVED WORKSFORME
Alias: None
Product: Jogl
Classification: JogAmp
Component: macosx (show other bugs)
Version: 2
Hardware: All all
: --- enhancement
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2013-10-04 01:37 CEST by Michael Bayne
Modified: 2013-10-10 20:34 CEST (History)
0 users

See Also:
Type: ---
SCM Refs:
Workaround: ---


Attachments
Test program showing bug (3.12 KB, application/octet-stream)
2013-10-04 01:37 CEST, Michael Bayne
Details

Note You need to log in before you can comment on or make changes to this 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!