swingFrame.setUndecorated( true ); desktop.setPreferredSize( new Dimension( width, height ) ); desktopWidth = width; desktopHeight = height;
    public JMEDesktop( String name, final int width, final int height, boolean mipMapping ) {        super( name, powerOf2SizeIfNeeded( width, mipMapping ), powerOf2SizeIfNeeded( height, mipMapping ) );        this.width = powerOf2SizeIfNeeded( width, mipMapping );        this.height = powerOf2SizeIfNeeded( height, mipMapping );        setModelBound( new OrientedBoundingBox() );        updateModelBound();//        super( name, width, height );//        this.width = width;//        this.height = height;        swingFrame = new JFrame() {            public boolean isShowing() {                return true;            }            public boolean isVisible() {                return initialized || super.isVisible();            }            public Graphics getGraphics() {                if ( !showingJFrame ) {                    return graphics == null ? super.getGraphics() : graphics.create();                }                else {                    return super.getGraphics();                }            }        };        final Color transparent = new Color( 0, 0, 0, 0 );        desktop = new JDesktopPane() {            public void paint( Graphics g ) {                if ( !isShowingJFrame() ) {                    g.clearRect( 0, 0, getWidth(), getHeight() );                }                super.paint( g );            }        };        dontDrawBackground( swingFrame.getContentPane() );        desktop.setBackground( transparent );        desktop.setFocusable( true );        desktop.addMouseListener( new MouseAdapter() {            public void mousePressed( MouseEvent e ) {                desktop.requestFocusInWindow();            }        } );        swingFrame.getContentPane().add( desktop );        ( (JComponent) swingFrame.getContentPane() ).setOpaque( false );        swingFrame.setUndecorated( true );        desktop.setPreferredSize( new Dimension( width, height ) );        desktopWidth = width;        desktopHeight = height;        swingFrame.pack();        TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();        texture = new Texture();        texture.setCorrection( Texture.CM_PERSPECTIVE );        texture.setFilter( Texture.FM_LINEAR );        texture.setMipmapState( mipMapping ? Texture.MM_LINEAR_LINEAR : Texture.MM_LINEAR );        texture.setWrap( Texture.WM_WRAP_S_WRAP_T );        graphics = ImageGraphics.createInstance( this.width, this.height, mipMapping ? 2 : 0 );        enableAntiAlias( graphics );        graphics.translate( ( this.width - width ) * 0.5f, ( this.height - height ) * 0.5f );        texture.setImage( graphics.getImage() );        texture.setScale( new Vector3f( 1, -1, 1 ) );        ts.setTexture( texture );        ts.apply();        this.setRenderState( ts );        AlphaState alpha = DisplaySystem.getDisplaySystem().getRenderer().createAlphaState();        alpha.setEnabled( true );        alpha.setBlendEnabled( true );        alpha.setSrcFunction( AlphaState.SB_SRC_ALPHA );        alpha.setDstFunction( AlphaState.DB_ONE_MINUS_SRC_ALPHA );        alpha.setTestEnabled( true );        alpha.setTestFunction( AlphaState.TF_GREATER );        this.setRenderState( alpha );        initialized = true;//        Toolkit.getDefaultToolkit().addAWTEventListener( new AWTEventListener() {//            public void eventDispatched( AWTEvent event ) {//                if ( isShowingJFrame() ) {//                    System.out.println( event );//                }//            }//        }, 0xFFFFFFFFFFFFFFFFl );        MouseInput.get().addListener( new MouseInputListener() {            public void onButton( int button, boolean pressed, int x, int y ) {                sendAWTMouseEvent( x, y, pressed, button );            }            public void onWheel( int wheelDelta, int x, int y ) {                sendAWTWheelEvent( wheelDelta, x, y );            }            public void onMove( int xDelta, int yDelta, int newX, int newY ) {                sendAWTMouseEvent( newX, newY, false, -1 );            }        } );        KeyInput.get().addListener( new KeyInputListener() {            public void onKey( final char character, final int keyCode, final boolean pressed ) {                try {                    SwingUtilities.invokeAndWait( new Runnable() {                        public void run() {                            sendAWTKeyEvent( keyCode, pressed, character );                        }                    } );                } catch ( InterruptedException e ) {                    e.printStackTrace();                } catch ( InvocationTargetException e ) {                    e.printStackTrace();                }            }        } );//        System.setProperty("sun.awt.noerasebackground", "true");        RepaintManager.currentManager( null ).setDoubleBufferingEnabled( false );        PopupFactory.setSharedInstance( new PopupFactory() {            public Popup getPopup( Component owner, Component contents, int x, int y ) throws IllegalArgumentException {                LightWeightPopup popup = new LightWeightPopup();                popup.adjust( owner, contents, x, y );                return popup;            }        } );    }