当前位置: 首页>>代码示例>>Java>>正文


Java WindowAdapter类代码示例

本文整理汇总了Java中com.jogamp.newt.event.WindowAdapter的典型用法代码示例。如果您正苦于以下问题:Java WindowAdapter类的具体用法?Java WindowAdapter怎么用?Java WindowAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WindowAdapter类属于com.jogamp.newt.event包,在下文中一共展示了WindowAdapter类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.jogamp.newt.event.WindowAdapter; //导入依赖的package包/类
public static void main(String[] args) {
    GLProfile glp = GLProfile.get("GL3");

    GLCapabilities caps = new GLCapabilities(glp);

    GLWindow glWindow = GLWindow.create(caps);
    glWindow.setSize(800, 600);
    glWindow.setVisible(true);

    glWindow.addWindowListener(new WindowAdapter() {
        public void windowDestroyNotify(WindowEvent e) {
            System.exit(0);
        }
    });

    FPSAnimator animator = new FPSAnimator(glWindow, 60);
    animator.start();
}
 
开发者ID:bensmith87,项目名称:jogl_gradle,代码行数:19,代码来源:Main.java

示例2: setup

import com.jogamp.newt.event.WindowAdapter; //导入依赖的package包/类
private void setup() {

        GLProfile glProfile = GLProfile.get(GLProfile.GL3);
        GLCapabilities glCapabilities = new GLCapabilities(glProfile);

        window = GLWindow.create(glCapabilities);

        window.setTitle("Hello Triangle (enhanced)");
        window.setSize(1024, 768);

        window.setVisible(true);

        window.addGLEventListener(this);
        window.addKeyListener(this);

        animator = new Animator(window);
        animator.start();

        window.addWindowListener(new WindowAdapter() {
            @Override
            public void windowDestroyed(WindowEvent e) {
                animator.stop();
                System.exit(1);
            }
        });
    }
 
开发者ID:java-opengl-labs,项目名称:hello-triangle,代码行数:27,代码来源:HelloTriangle.java

示例3: createWindow

import com.jogamp.newt.event.WindowAdapter; //导入依赖的package包/类
@Override
public Object createWindow(GLCapabilities caps, int width, int height) {
	final Animator animator;
	setAutoDrawable(glWin = GLWindow.create(caps));
	setAnimator(animator = new Animator(glWin));
	glWin.addWindowListener(new WindowAdapter() {
		@Override
		public void windowDestroyNotify(WindowEvent e) {
			animator.stop();
			glWin.setVisible(false);
			// prevent jogl babbling about unimportant stuff
			System.err.close();
			System.exit(0);
		}
	});

	glWin.setDefaultCloseOperation(WindowClosingMode.DISPOSE_ON_CLOSE);
	glWin.setSize(width, height);
	glWin.setTitle("bGLOOP");
	return glWin;
}
 
开发者ID:trent2,项目名称:bGLOOP,代码行数:22,代码来源:NEWTWindow.java

示例4: setup

import com.jogamp.newt.event.WindowAdapter; //导入依赖的package包/类
private void setup() {

        GLProfile glProfile = GLProfile.get(GLProfile.GL3);
        GLCapabilities glCapabilities = new GLCapabilities(glProfile);

        window = GLWindow.create(glCapabilities);

        window.setTitle("Hello Triangle (enhanced)");
        window.setSize(1024, 768);

        window.addGLEventListener(this);
        window.addKeyListener(this);

        window.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG);
        window.setVisible(true);

        animator = new Animator(window);
        animator.start();

        window.addWindowListener(new WindowAdapter() {
            @Override
            public void windowDestroyed(WindowEvent e) {
                animator.stop();
                System.exit(1);
            }
        });
    }
 
开发者ID:java-opengl-labs,项目名称:hello-triangle,代码行数:28,代码来源:HelloTriangle.java

示例5: setup

import com.jogamp.newt.event.WindowAdapter; //导入依赖的package包/类
private void setup() {

        GLProfile glProfile = GLProfile.get(GLProfile.GL3);
        GLCapabilities glCapabilities = new GLCapabilities(glProfile);

        window = GLWindow.create(glCapabilities);

        window.setTitle("Hello Globe");
        window.setSize(1024, 768);

        window.setContextCreationFlags(GLContext.CTX_OPTION_DEBUG);
        window.setVisible(true);

        window.addGLEventListener(this);
        window.addKeyListener(this);

        animator = new Animator(window);
        animator.start();

        window.addWindowListener(new WindowAdapter() {
            @Override
            public void windowDestroyed(WindowEvent e) {
                animator.stop();
                System.exit(1);
            }
        });
    }
 
开发者ID:java-opengl-labs,项目名称:hello-triangle,代码行数:28,代码来源:HelloGlobe.java

示例6: setup

import com.jogamp.newt.event.WindowAdapter; //导入依赖的package包/类
private void setup() {

        GLProfile glProfile = GLProfile.get(GLProfile.GL3);
        GLCapabilities glCapabilities = new GLCapabilities(glProfile);

        window = GLWindow.create(glCapabilities);

        window.setTitle("Hello Texture");
        window.setSize(1024, 768);

        window.setVisible(true);

        window.addGLEventListener(this);
        window.addKeyListener(this);

        animator = new Animator();
        animator.add(window);
        animator.start();

        window.addWindowListener(new WindowAdapter() {
            @Override
            public void windowDestroyed(WindowEvent e) {
                animator.stop();
                System.exit(1);
            }
        });

    }
 
开发者ID:java-opengl-labs,项目名称:hello-triangle,代码行数:29,代码来源:HelloTexture.java

示例7: setup

import com.jogamp.newt.event.WindowAdapter; //导入依赖的package包/类
private void setup() {

        GLProfile glProfile = GLProfile.get(GLProfile.GL3);
        GLCapabilities glCapabilities = new GLCapabilities(glProfile);

        window = GLWindow.create(glCapabilities);

        window.setTitle("Hello Triangle (simple)");
        window.setSize(1024, 768);

        window.setVisible(true);

        window.addGLEventListener(this);
        window.addKeyListener(this);

        animator = new Animator(window);
        animator.start();

        window.addWindowListener(new WindowAdapter() {
            @Override
            public void windowDestroyed(WindowEvent e) {
                animator.stop();
                System.exit(1);
            }
        });

    }
 
开发者ID:java-opengl-labs,项目名称:hello-triangle,代码行数:28,代码来源:HelloTriangleSimple.java

示例8: main

import com.jogamp.newt.event.WindowAdapter; //导入依赖的package包/类
public static void main(final String[] args) {
    final GLProfile glp = GLProfile.getGL2ES2();
    final GLCapabilities caps = new GLCapabilities(glp);
    caps.setAlphaBits(4);
    caps.setSampleBuffers(true);
    caps.setNumSamples(4);
    System.out.println("Requested: " + caps);

    final GLWindow window = GLWindow.create(caps);
    window.setPosition(10, 10);
    window.setSize(800, 400);
    window.setTitle("GPU UI Newt Demo 01");
    final RenderState rs = RenderState.createRenderState(SVertex.factory());
    final UIGLListener01 uiGLListener = new UIGLListener01 (0, rs, DEBUG, TRACE);
    uiGLListener.attachInputListenerTo(window);
    window.addGLEventListener(uiGLListener);
    window.setVisible(true);

    final Animator animator = new Animator();
    animator.setUpdateFPSFrames(60, System.err);
    animator.add(window);

    window.addKeyListener(new KeyAdapter() {
        public void keyPressed(final KeyEvent arg0) {
            if(arg0.getKeyCode() == KeyEvent.VK_F4) {
                window.destroy();
            }
        }
    });
    window.addWindowListener(new WindowAdapter() {
        public void windowDestroyed(final WindowEvent e) {
            animator.stop();
        }
    });

    animator.start();
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:38,代码来源:UINewtDemo01.java

示例9: addWindowListener

import com.jogamp.newt.event.WindowAdapter; //导入依赖的package包/类
@Override
public void addWindowListener(final WindowAdapter pWindowAdapter) {
	mGlWindow.addWindowListener(pWindowAdapter);
}
 
开发者ID:ClearVolume,项目名称:ClearGL,代码行数:5,代码来源:ClearGLWindow.java

示例10: initGL

import com.jogamp.newt.event.WindowAdapter; //导入依赖的package包/类
/**
 * Initialise the JOGL Window
 */
private void initGL()
{
	// Get the OpenGL profile and its capabilities.
	// Tries to get OpenGL 3
	final GLProfile glp = GLProfile.get( GLProfile.GL2 );
	final GLCapabilities caps = new GLCapabilities( glp );

	// Get the display
	final Display dpy = NewtFactory.createDisplay( null );

	// Get the screen on the display (defaults to the first screen)
	final Screen screen = NewtFactory.createScreen( dpy, this.screenIdx );

	// Create a window
	this.glWindow = GLWindow.create( screen, caps );

	// Set the size and position of the window
	this.glWindow.setSize( this.width, this.height );
	if( null != this.wpos ) this.glWindow.setPosition( this.wpos.getX(), this.wpos.getY() );

	// Set the properties of the window
	this.glWindow.setUndecorated( this.undecorated );
	this.glWindow.setAlwaysOnTop( this.alwaysOnTop );
	this.glWindow.setFullscreen( this.fullscreen );
	this.glWindow.setPointerVisible( this.mouseVisible );
	this.glWindow.confinePointer( this.mouseConfined );

	// Add a listener to kill the app once the window is closed
	this.glWindow.addWindowListener( new WindowAdapter()
	{
		@Override
		public void windowDestroyNotify(final WindowEvent e)
		{
			System.exit(1);
		};
	} );

	// Show the window
	this.glWindow.setVisible( true );
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:44,代码来源:JOGLWindow.java

示例11: main

import com.jogamp.newt.event.WindowAdapter; //导入依赖的package包/类
public static void main(final String[] args) {
    int width = 800, height = 400;
    int x = 10, y = 10;

    boolean forceES2 = false;
    boolean forceES3 = false;
    boolean forceGL3 = false;
    boolean forceGLDef = false;

  
    System.err.println("forceES2   "+forceES2);
    System.err.println("forceES3   "+forceES3);
    System.err.println("forceGL3   "+forceGL3);
    System.err.println("forceGLDef "+forceGLDef);
    System.err.println("Desired win size "+width+"x"+height);
    System.err.println("Desired win pos  "+x+"/"+y);
    System.err.println("Scene MSAA Samples "+SceneMSAASamples);
    System.err.println("Graph MSAA Mode "+GraphMSAAMode);
    System.err.println("Graph VBAA Mode "+GraphVBAAMode);
    System.err.println("Graph Auto Mode "+GraphAutoMode+" no-AA dpi threshold");

    final GLProfile glp;
    if(forceGLDef) {
        glp = GLProfile.getDefault();
    } else if(forceGL3) {
        glp = GLProfile.get(GLProfile.GL3);
    } else if(forceES3) {
        glp = GLProfile.get(GLProfile.GLES3);
    } else if(forceES2) {
        glp = GLProfile.get(GLProfile.GLES2);
    } else {
        glp = GLProfile.getGL2ES2();
    }
    System.err.println("GLProfile: "+glp);
    final GLCapabilities caps = new GLCapabilities(glp);
    caps.setAlphaBits(4);
    if( SceneMSAASamples > 0 ) {
        caps.setSampleBuffers(true);
        caps.setNumSamples(SceneMSAASamples);
    }
    System.out.println("Requested: " + caps);

    final int rmode;
    if( GraphVBAAMode ) {
        rmode = Region.VBAA_RENDERING_BIT;
    } else if( GraphMSAAMode ) {
        rmode = Region.MSAA_RENDERING_BIT;
    } else {
        rmode = 0;
    }

    final GLWindow window = GLWindow.create(caps);
    window.setPosition(x, y);
    window.setSize(width, height);
    window.setTitle("GraphUI Newt Demo: graph["+Region.getRenderModeString(rmode)+"], msaa "+SceneMSAASamples);
    window.setSurfaceScale(reqSurfacePixelScale);
    final float[] valReqSurfacePixelScale = window.getRequestedSurfaceScale(new float[2]);

    final GPUUISceneGLListener0A sceneGLListener = 0 < GraphAutoMode ? new GPUUISceneGLListener0A(GraphAutoMode, DEBUG, TRACE) :
                                                                 new GPUUISceneGLListener0A(rmode, DEBUG, TRACE);

    window.addGLEventListener(sceneGLListener);
    sceneGLListener.attachInputListenerTo(window);

    final Animator animator = new Animator();
    animator.setUpdateFPSFrames(60, System.err);
    animator.add(window);

    window.addWindowListener(new WindowAdapter() {
        public void windowDestroyed(final WindowEvent e) {
            animator.stop();
        }
    });

    window.setVisible(true);
    animator.start();
}
 
开发者ID:philjord,项目名称:3DTools,代码行数:78,代码来源:GPUUISceneNewtDemo.java

示例12: addWindowListener

import com.jogamp.newt.event.WindowAdapter; //导入依赖的package包/类
public void addWindowListener(WindowAdapter pWindowAdapter); 
开发者ID:ClearVolume,项目名称:ClearGL,代码行数:2,代码来源:ClearGLDisplayable.java


注:本文中的com.jogamp.newt.event.WindowAdapter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。