DisplaySystem display = DisplaySystem.getDisplaySystem(); display.setMinDepthBits( depthBits ); display.setMinStencilBits( stencilBits ); display.setMinAlphaBits( alphaBits ); display.setMinSamples( samples );
    public void init() {        synchronized (INIT_LOCK) {            TextureManager.clearCache();            Text.resetFontTexture();            try {                DisplaySystem.getDisplaySystem().prepForApplet();            } catch (Exception le) {                /* screwed */                le.printStackTrace();            }            glCanvas = DisplaySystem.getDisplaySystem().createCanvas(640, 480);            // Important! Here is where we add the guts to the canvas:            impl = new SimpleAppletCanvasImplementor(getWidth(), getHeight());            ((JMECanvas) glCanvas).setImplementor(impl);            setLayout(new BorderLayout());            add(glCanvas, BorderLayout.CENTER);            glCanvas.addComponentListener(new ComponentAdapter() {                public void componentResized(ComponentEvent ce) {                    if (impl != null) {                        impl.resizeCanvas(glCanvas.getWidth(), glCanvas                                .getHeight());                        if (impl.getCamera() != null) {                            RenderThreadExecutable exe = new RenderThreadExecutable() {                                public void doAction() {                                    impl.getCamera().setFrustumPerspective(                                            45.0f,                                            (float) glCanvas.getWidth()                                                    / (float) glCanvas                                                            .getHeight(), 1,                                            1000);                                }                            };                            RenderThreadActionQueue.addToQueue(exe);                        }                    }                }            });            glCanvas.setFocusable(true);            glCanvas.addFocusListener(new FocusListener() {                public void focusGained(FocusEvent arg0) {                    ((AWTKeyInput) KeyInput.get()).setEnabled(true);                    ((AWTMouseInput) MouseInput.get()).setEnabled(true);                }                public void focusLost(FocusEvent arg0) {                    ((AWTKeyInput) KeyInput.get()).setEnabled(false);                    ((AWTMouseInput) MouseInput.get()).setEnabled(false);                }            });            DisplaySystem display = DisplaySystem.getDisplaySystem();            display.setMinDepthBits( depthBits );            display.setMinStencilBits( stencilBits );            display.setMinAlphaBits( alphaBits );            display.setMinSamples( samples );            // We are going to use jme's Input systems, so enable updating.            ((JMECanvas) glCanvas).setUpdateInput(true);            if (!KeyInput.isInited())                KeyInput.setProvider(InputSystem.INPUT_SYSTEM_AWT);            ((AWTKeyInput) KeyInput.get()).setEnabled(false);            KeyListener kl = (KeyListener) KeyInput.get();            glCanvas.addKeyListener(kl);            if (!MouseInput.isInited())                MouseInput.setProvider(InputSystem.INPUT_SYSTEM_AWT);            ((AWTMouseInput) MouseInput.get()).setEnabled(false);            ((AWTMouseInput) MouseInput.get()).setDragOnly(true);            glCanvas.addMouseListener((MouseListener) MouseInput.get());            glCanvas.addMouseWheelListener((MouseWheelListener) MouseInput                    .get());            glCanvas.addMouseMotionListener((MouseMotionListener) MouseInput                    .get());            glCanvas.addMouseMotionListener(new MouseMotionAdapter() {                public void mouseMoved(java.awt.event.MouseEvent e) {                    if (!glCanvas.hasFocus())                        glCanvas.requestFocus();                };            });            new Thread() {                {                    setDaemon(true);                }                public void run() {                    while (true) {                        if (isVisible() || status == STATUS_DESTROYING || status == STATUS_INITING)                            glCanvas.repaint();                        try {                            Thread.sleep(repaintSleepTime);                        } catch (InterruptedException e) { }                    }                }            }.start();        }    }