Re: GLCanvas Full Screen Cannot see in Teamviewer

Posted by robbiezl on
URL: https://forum.jogamp.org/GLCanvas-Full-Screen-Cannot-see-in-Teamviewer-tp4027475p4027481.html

The GLCanvas stii cannot show when fullscreen in Teamviewer8.
I choose another PC which is Windows  XP system, it has the same problem.I do not think it has a relation with the Win8 System.

My Example code:


package app;

import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;

import javax.media.opengl.awt.GLCanvas;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JRootPane;
import javax.swing.SwingUtilities;


public class TestFrame extends JFrame{

        private JPanel jMainPanel = null;
        private JPanel jCenterPanel = null;
        private GLCanvas glCanvas = null;
        private Canvas awtCanvas=null;

        /**
         * This method initializes
         *
         */
        public TestFrame() {
                super();
                initialize();
        }

        /**
         * This method initializes this
         *
         */
        private void initialize() {
        this.setSize(new Dimension(739, 512));
        this.setContentPane(getJMainPanel());
                this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                this.setLocation(500, 500);
        }

        /**
         * This method initializes jMainPanel
         *
         * @return javax.swing.JPanel
         */
        private JPanel getJMainPanel() {
                if (jMainPanel == null) {
                        jMainPanel = new JPanel();
                        jMainPanel.setLayout(new BorderLayout());
                        jMainPanel.add(getJCenterPanel(), BorderLayout.CENTER);
                }
                return jMainPanel;
        }

        /**
         * This method initializes jCenterPanel
         *
         * @return javax.swing.JPanel
         */
        private JPanel getJCenterPanel() {
                if (jCenterPanel == null) {
                        jCenterPanel = new JPanel();
                        jCenterPanel.setLayout(new BorderLayout());
                        //jCenterPanel.add(getGLCanvas(), BorderLayout.CENTER);
                        jCenterPanel.add(getAWTCanvas(), BorderLayout.CENTER);
                       
                       
                }
                return jCenterPanel;
        }

        /**
         * This method initializes jViewPanel
         *
         * @return javax.swing.JPanel
         */
        public GLCanvas getGLCanvas() {
                if (glCanvas == null) {
                        glCanvas=new GLCanvas();
                        glCanvas.setBackground(Color.GREEN);
                }
                return glCanvas;
        }
       
        public Canvas getAWTCanvas() {
                if (awtCanvas == null) {
                        awtCanvas=new Canvas();
                        awtCanvas.setBackground(Color.RED);
                }
                return awtCanvas;
        }
       
       
        public static void main(String[] args) {
                TestFrame aa=new TestFrame();
                aa.setVisible(true);
                switchFullScreen(aa);
        }
       
        public static void switchFullScreen(final JFrame baseFrame){

                baseFrame.dispose();

                baseFrame.setVisible(false);

                baseFrame.setUndecorated(true);

                baseFrame.getRootPane().setWindowDecorationStyle(JRootPane.NONE);

                baseFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);

                SwingUtilities.invokeLater(new Runnable(){
                        public void run() {
                                baseFrame.setVisible(true);
                        }
                });
        }
       
}  //  @jve:decl-index=0:visual-constraint="10,10"