本文整理汇总了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();
}
示例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);
}
示例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();
}
}
示例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);
}