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


Java GLCanvas.addMouseListener方法代码示例

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


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

示例1: Picking

import javax.media.opengl.awt.GLCanvas; //导入方法依赖的package包/类
Picking()
{
  Frame frame = new Frame("Picking Example");
  GLCapabilities capabilities = new GLCapabilities(null);
  GLCanvas drawable = new GLCanvas(capabilities);
  final Renderer renderer = new Renderer();
  drawable.addGLEventListener(renderer);
  drawable.addMouseListener(renderer);
  drawable.addMouseMotionListener(renderer);
  frame.add(drawable);
  frame.setSize(400, 400);
  final Animator animator = new Animator(drawable);
  frame.addWindowListener(new WindowAdapter()
    {
      public void windowClosing(WindowEvent e) 
      {
        animator.stop();
        System.exit(0);
      }
    });
  frame.setVisible(true);
  animator.start();	
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:24,代码来源:Picking.java

示例2: Scene

import javax.media.opengl.awt.GLCanvas; //导入方法依赖的package包/类
Scene(Kengine kengine){
    this.kengine = kengine;
    GLProfile glprofile = GLProfile.getDefault();
    GLCapabilities glcapabilities = new GLCapabilities( glprofile );
    canvas = new GLCanvas(glcapabilities);
    canvas.setSize(kengine.getWidth(), kengine.getHeight());
    canvas.addGLEventListener(this);
    canvas.addMouseMotionListener(mkMouseAdapter());
    canvas.addMouseListener(mkMouseAdapter());
    canvas.addKeyListener(mkKeyAdapter());
    canvas.requestFocus();

    fpsa = new FPSAnimator(canvas,60,true);
    fpsa.start();

    kengine.add(canvas);

    hideCursor();
    try {
        rob = new Robot();
    } catch (AWTException e) {
        e.printStackTrace();
    }
    mouseCenter = (int) (kengine.getHeight()*.5);
}
 
开发者ID:seemywingz,项目名称:Kengine,代码行数:26,代码来源:Scene.java

示例3: run

import javax.media.opengl.awt.GLCanvas; //导入方法依赖的package包/类
@Override
public void run() {
	GLCanvas canvas = new Scene();
	canvas.setPreferredSize(new Dimension(Constant.CANVAS_WIDTH,
			Constant.CANVAS_HEIGHT));

	JFrame frame = new JFrame();
	frame.getContentPane().add(canvas);
	frame.addWindowListener(new WindowAdapter() {
		@Override
		public void windowClosing(WindowEvent e) {
			new Thread(new CloseTask()).start();
		}
	});
	frame.setTitle(Constant.TITLE);
	frame.pack();
	frame.setVisible(true);
	MouseListenerImpl mouseListen = new MouseListenerImpl();
	canvas.addMouseListener(mouseListen);
	canvas.addMouseMotionListener(mouseListen);
	while (true) {
		canvas.display();
	}
}
 
开发者ID:galaxy-workstation,项目名称:AircraftDemo,代码行数:25,代码来源:RenderTask.java

示例4: Window

import javax.media.opengl.awt.GLCanvas; //导入方法依赖的package包/类
/**
 *
 * @todo Write documentation
 * @param game
 * @since 0.1
 */
public Window(Game game)
{
	this.game = game;
	mouse = new Mouse();
	setSize(600, 400);
	capabilities = new GLCapabilities(GLProfile.getDefault());
	canvas = new GLCanvas(capabilities);
	add(canvas);
	canvas.addMouseListener(mouse);
	canvas.addGLEventListener(this);
	addWindowListener(this);
	addMouseListener(mouse);
}
 
开发者ID:TheAtlas,项目名称:Atlas-Game-Framework,代码行数:20,代码来源:Window.java


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