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


Java GLCanvas.addMouseListener方法代码示例

本文整理汇总了Java中com.jogamp.opengl.awt.GLCanvas.addMouseListener方法的典型用法代码示例。如果您正苦于以下问题:Java GLCanvas.addMouseListener方法的具体用法?Java GLCanvas.addMouseListener怎么用?Java GLCanvas.addMouseListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jogamp.opengl.awt.GLCanvas的用法示例。


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

示例1: Shoot

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
Shoot()
{	
	System.out.printf("THREAD_COUNT:%4d\n", THREAD_COUNT);
	GLProfile glp = GLProfile.getDefault();
	GLCapabilities caps = new GLCapabilities(glp);
	caps.setSampleBuffers(true);
	caps.setNumSamples(8);
	
	canvas = new GLCanvas(caps);
	canvas.setSize(1000, 1000);
	canvas.addMouseListener(mcontrol);
	canvas.addKeyListener(kbcontrol);
	
	disp = new Display(this);
	disp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	disp.setSize(1000,1000);
	disp.add(canvas);
	disp.setVisible(true);
	disp.addKeyListener(kbcontrol);
	
	canvas.addGLEventListener(disp);
	animator = new FPSAnimator(canvas, 50);
	
	mtProjectiles = new MT_Generic<Projectile>(entityWrapper.projectiles, es);
	mtDynamics = new MT_Generic<Dynamic>(entityWrapper.dynamics, es);
	mtEntMov = new MT_EntMovement(entityWrapper.pathEnts, es);
	
	inst = this;
}
 
开发者ID:ben-j-c,项目名称:TopDownGame,代码行数:30,代码来源:Shoot.java

示例2: setSelected

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
/**
 * When this is selected in the FilterPanel GUI, the mouse listeners will be
 * added. When this is unselected, the listeners will be removed.
 *
 */
@Override
public void setSelected(boolean yes) {
    super.setSelected(yes);
    chipCanvas = chip.getCanvas();
    if (chipCanvas == null) {
        log.warning("null chip canvas, can't add mouse listeners");
        return;
    }
    glCanvas = (GLCanvas) chipCanvas.getCanvas();
    if (glCanvas == null) {
        log.warning("null chip canvas GL drawable, can't add mouse listeners");
        return;
    }
    if (yes) {
        glCanvas.removeMouseListener(this);
        glCanvas.removeMouseMotionListener(this);
        glCanvas.removeMouseWheelListener(this);
        glCanvas.addMouseListener(this);
        glCanvas.addMouseMotionListener(this);
        glCanvas.addMouseWheelListener(this);

    } else {
        glCanvas.removeMouseListener(this);
        glCanvas.removeMouseMotionListener(this);
        glCanvas.removeMouseWheelListener(this);
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:33,代码来源:EventFilter2DMouseAdaptor.java

示例3: main

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
public static void main(String[] args)
	{
		
		System.setProperty("sun.awt.noerasebackground", "true");
		
		SimpleScene scene = new SimpleScene();

		Button button = new Button(20, 20, 50, 20, "123456");
		button.setFontSize(60);
		MoveablePanel panel = new MoveablePanel(10, 10, 300, 300);
		panel.setName("Yellow Panel");
		panel.setBackground(Color.YELLOW);
		panel.addChild(button);
//		//Label label = new Label("Test Label", 100, 100);
//		//panel.addChild(label);
//		//CheckBox cb = new CheckBox(250, 100);
//		//ComboBox cb = new ComboBox(250, 100);
//		//panel.addChild(cb);
		scene.addChild(panel);
		
		GLProfile glp = GLProfile.getDefault();
		GLCapabilities caps = new GLCapabilities(glp);
		GLCanvas canvas = new GLCanvas(caps);
		canvas.addGLEventListener(scene);
		
		JFrame frame = new JFrame("A Window");
		frame.setSize(700, 700);
		frame.setVisible(true);
		frame.add(canvas);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		canvas.addMouseListener(scene);
		canvas.addMouseMotionListener(scene);
		
		FPSAnimator animator = new FPSAnimator(canvas, 60);
		animator.start();
		
	}
 
开发者ID:carterg,项目名称:GLGUI,代码行数:38,代码来源:Test.java

示例4: main

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
public static void main(String[] args) {
    Frame frame = new Frame("Delaunay Triangulation Example");
    frame.setResizable(false);

    GLCapabilities caps = new GLCapabilities(GLProfile.get("GL2"));
    caps.setSampleBuffers(true);
    caps.setNumSamples(8);

    GLCanvas canvas = new GLCanvas(caps);

    DelaunayTriangulationExample ex = new DelaunayTriangulationExample();
    MouseListener lister = ex;
    canvas.addGLEventListener(ex);
    canvas.setPreferredSize(DIMENSION);
    canvas.addMouseListener(lister);

    frame.add(canvas);

    final FPSAnimator animator = new FPSAnimator(canvas, 25);

    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            new Thread(new Runnable() {
                public void run() {
                    animator.stop();
                    System.exit(0);
                }
            }).start();
        }
    });

    frame.setVisible(true);
    frame.pack();
    animator.start();
}
 
开发者ID:jdiemke,项目名称:delaunay-triangulator,代码行数:36,代码来源:DelaunayTriangulationExample.java

示例5: MainWindow

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
/**
 * Constructor.
 * @param width the width of the window in pixels
 * @param height the height of the window in pixels
 */
public MainWindow(int width, int height) {
    GLProfile glp = GLProfile.get(GLProfile.GL2);
    GLCapabilities caps = new GLCapabilities(glp);

    canvas = new GLCanvas(caps);

    frame = new Frame();
    frame.setSize(width, height);
    frame.add(canvas);
    frame.setVisible(true);

    frame.addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosing(WindowEvent e) {
            LOGGER.info("Window closing event");
            stop();
        }
    });

    mouseListener = new WindowMouseListener();
    keyListener = new WindowKeyListener();

    canvas.addGLEventListener(new GlEventHandler());
    canvas.addMouseListener(mouseListener);
    canvas.addMouseMotionListener(mouseListener);
    canvas.addMouseWheelListener(mouseListener);
    canvas.addKeyListener(keyListener);

    animator = new FPSAnimator(canvas, FRAMES_PER_SECOND);
    animator.start();
}
 
开发者ID:bensmith87,项目名称:ui,代码行数:38,代码来源:MainWindow.java

示例6: InitGL

import com.jogamp.opengl.awt.GLCanvas; //导入方法依赖的package包/类
void InitGL() {

        GLProfile kProfile = GLProfile.getMaxProgrammable(true);
        GLCapabilities kGlCapabilities = new GLCapabilities(kProfile);
        kGlCapabilities.setHardwareAccelerated(true);
        m_kCanvas = new GLCanvas(kGlCapabilities);
        m_kCanvas.setSize(g_imageWidth, g_imageHeight);
        m_kCanvas.addGLEventListener(this);
        m_kCanvas.addKeyListener(this);
        m_kCanvas.addMouseListener(this);
        m_kCanvas.addMouseMotionListener(this);
    }
 
开发者ID:java-opengl-labs,项目名称:oit,代码行数:13,代码来源:DualDepthPeeling.java


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