Layering Swing components on top of a PApplet

edited January 2014 in Library Questions

Hey all,

I've been working with the Unfolding Maps library, and this library uses a PApplet to display the map. My issue is that I am trying to layer a JPanel (Swing component) on top of a PApplet. I am able to layer the JPanel on top of another JPanel, but when I try to layer the JPanel on top of the PApplet, the PApplet is no longer displayed. I read through the PApplet documentation, and it does mention issues that arise when drawing Swing components on top of a PApplet, but I have not been able to find a resolution to this issue.

Is there a way I can layer a transparent JPanel on top of a PApplet and still maintain the functionality of the PApplet and the JPanel?

Thank you in advanced.

Answers

  • "I am trying to layer a JPanel (Swing component) on top of a PApplet"
    Why? I am asking because perhaps there is an alternative to this...

  • I am trying to add buttons and scrollbars "on top of" the map (similar to a GoogleMaps style). In essence, the buttons and scrollbars should appear as though they are "on top" of the map.

  • Instead of using Swing, you should consider a Processing GUI library.

  • That is a good alternative, except that the program is already written using Swing, and a conversion of the project to a non-Swing GUI does not seem like a feasible alternative at this stage. (Although, if this weren't the case, your suggestion would be a good alternative.) Thank you.

  • Answer ✓

    You should read up about layering Swing components (lightweight) over AWT components (heavyweight), since an Applet is from the AWT realm (IIRC).

Sign In or Register to comment.