Mixing GLCanvas and jScrollPane

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Mixing GLCanvas and jScrollPane

sylvestre
Hello,

Using JOGL 2, I have a problem with using a GLCanvas into a JScrollPane.
As you can see in the Incorrect.png [1] screenshot, the graphic is not correctly positioned. Correct.png [2] shows what I should get.

The current SWIG tree is:
JFrame
   - JPanel (BorderLayout)
     - JTextArea (BorderLayout.NORTH)
     - JScrollPane (BorderLayout.CENTER)
       - GLCanvas.

I know that mixing AWT (GLCanvas) with SWING is not easy but it is now well supported by recent JVM versions. I am using GLCanvas to get better performances.

Any idea?

Thanks
Sylvestre
[1] Correct:

[2] Incorrect:
Reply | Threaded
Open this post in threaded view
|

Re: Mixing GLCanvas and jScrollPane

Sven Gothel
Administrator
On 05/23/2012 11:10 AM, sylvestre [via jogamp] wrote:

> Hello,
>
> Using JOGL 2, I have a problem with using a GLCanvas into a JScrollPane.
> As you can see in the Incorrect.png [1] screenshot, the graphic is not
> correctly positioned. Correct.png [2] shows what I should get.
>
> The current SWIG tree is:
> JFrame
>    - JPanel (BorderLayout)
>      - JTextArea (BorderLayout.NORTH)
>      - JScrollPane (BorderLayout.CENTER)
>        - GLCanvas.
>
> I know that mixing AWT (GLCanvas) with SWING is not easy but it is now well
> supported by recent JVM versions. I am using GLCanvas to get better performances.
>
> Any idea?
>

If you could provide a complete and possibly small example (source code)
we might be able to understand the issue and help.

~Sven

Reply | Threaded
Open this post in threaded view
|

Re: Mixing GLCanvas and jScrollPane

robbiezl
In reply to this post by sylvestre
I think maybe u should add GLCanvas on ScrollPane(AWT) and add ScrollPane on a JPanel.
I do not test my idea yet!
Reply | Threaded
Open this post in threaded view
|

Re: Mixing GLCanvas and jScrollPane

sylvestre
In reply to this post by Sven Gothel
Here is the test case:
JScrollPaneExample.java

Works with the GLJPanel:
java -cp /usr/share/java/jogl2.jar:/usr/share/java/gluegen2.jar:. -DGLJPanel=1 JScrollPaneExample

Bug with GLCanvas:
java -cp /usr/share/java/jogl2.jarusr/share/java/gluegen2.jar:.  JScrollPaneExample
Move the scrollbar, it will show clearly the issue.

Fails with both rc5 and rc8 under Linux
Reply | Threaded
Open this post in threaded view
|

Re: Mixing GLCanvas and jScrollPane

robbiezl
  ScrollPane scrollPane = new ScrollPane();
  scrollPane.add(glComponent);