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