本文整理了Java中java.awt.Canvas.addKeyListener()
方法的一些代码示例,展示了Canvas.addKeyListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Canvas.addKeyListener()
方法的具体详情如下:
包路径:java.awt.Canvas
类名称:Canvas
方法名:addKeyListener
暂无
代码示例来源:origin: libgdx/libgdx
public void setListeners (Canvas canvas) {
if (this.canvas != null) {
canvas.removeMouseListener(this);
canvas.removeMouseMotionListener(this);
canvas.removeMouseWheelListener(this);
canvas.removeKeyListener(this);
}
canvas.addMouseListener(this);
canvas.addMouseMotionListener(this);
canvas.addMouseWheelListener(this);
canvas.addKeyListener(this);
canvas.setFocusTraversalKeysEnabled(false);
this.canvas = canvas;
}
代码示例来源:origin: libgdx/libgdx
public void setListeners (Canvas canvas) {
if (this.canvas != null) {
canvas.removeMouseListener(this);
canvas.removeMouseMotionListener(this);
canvas.removeMouseWheelListener(this);
canvas.removeKeyListener(this);
}
canvas.addMouseListener(this);
canvas.addMouseMotionListener(this);
canvas.addMouseWheelListener(this);
canvas.addKeyListener(this);
canvas.setFocusTraversalKeysEnabled(false);
this.canvas = canvas;
}
代码示例来源:origin: google/sagetv
c.addKeyListener(this);
代码示例来源:origin: caprica/vlcj-player
this.mediaPlayerComponent.getVideoSurface().addMouseWheelListener(mouseEventHandler);
this.mediaPlayerComponent.getVideoSurface().addKeyListener(new KeyEventHandler());
代码示例来源:origin: google/sagetv
c.addKeyListener(this);
c.addMouseListener(this);
addMouseWheelListener(this);
代码示例来源:origin: mpicbg/mpicbg_
/**
* Add new event handlers.
*/
final void takeOverGui()
{
canvas.addKeyListener( Stack_Rotate.this );
window.addKeyListener( Stack_Rotate.this );
canvas.addMouseMotionListener( Stack_Rotate.this );
canvas.addMouseListener( Stack_Rotate.this );
ij.addKeyListener( Stack_Rotate.this );
window.addMouseWheelListener( Stack_Rotate.this );
scrollBar.addAdjustmentListener( Stack_Rotate.this );
updateScrollBar();
}
代码示例来源:origin: axtimwalde/mpicbg
/**
* Add new event handlers.
*/
final void takeOverGui()
{
canvas.addKeyListener( Stack_Rotate.this );
window.addKeyListener( Stack_Rotate.this );
canvas.addMouseMotionListener( Stack_Rotate.this );
canvas.addMouseListener( Stack_Rotate.this );
ij.addKeyListener( Stack_Rotate.this );
window.addMouseWheelListener( Stack_Rotate.this );
scrollBar.addAdjustmentListener( Stack_Rotate.this );
updateScrollBar();
}
代码示例来源:origin: org.processing/core
canvas.addKeyListener(new KeyListener() {
代码示例来源:origin: net.imagej/ij
if (ij!=null) {
addKeyListener(ij);
ic.addKeyListener(ij);
ic.addMouseListener(ij);
代码示例来源:origin: com.badlogicgames.gdx/gdx-backend-lwjgl
public void setListeners (Canvas canvas) {
if (this.canvas != null) {
canvas.removeMouseListener(this);
canvas.removeMouseMotionListener(this);
canvas.removeMouseWheelListener(this);
canvas.removeKeyListener(this);
}
canvas.addMouseListener(this);
canvas.addMouseMotionListener(this);
canvas.addMouseWheelListener(this);
canvas.addKeyListener(this);
canvas.setFocusTraversalKeysEnabled(false);
this.canvas = canvas;
}
代码示例来源:origin: imagej/ImageJA
if (ij!=null) {
addKeyListener(ij);
ic.addKeyListener(ij);
ic.addMouseListener(ij);
代码示例来源:origin: mpicbg/mpicbg_
/**
* Restore the previously active Event handlers.
*/
final void restoreGui()
{
clearGui();
for ( final KeyListener l : canvasKeyListeners )
canvas.addKeyListener( l );
for ( final KeyListener l : windowKeyListeners )
window.addKeyListener( l );
for ( final KeyListener l : ijKeyListeners )
ij.addKeyListener( l );
for ( final MouseListener l : canvasMouseListeners )
canvas.addMouseListener( l );
for ( final MouseMotionListener l : canvasMouseMotionListeners )
canvas.addMouseMotionListener( l );
for ( final MouseWheelListener l : windowMouseWheelListeners )
window.addMouseWheelListener( l );
for ( final AdjustmentListener l : scrollBarAdjustmentListeners )
scrollBar.addAdjustmentListener( l );
scrollBar.setValues( scrollBarValue, scrollBarVisible, scrollBarMin, scrollBarMax );
}
代码示例来源:origin: axtimwalde/mpicbg
/**
* Restore the previously active Event handlers.
*/
final void restoreGui()
{
clearGui();
for ( final KeyListener l : canvasKeyListeners )
canvas.addKeyListener( l );
for ( final KeyListener l : windowKeyListeners )
window.addKeyListener( l );
for ( final KeyListener l : ijKeyListeners )
ij.addKeyListener( l );
for ( final MouseListener l : canvasMouseListeners )
canvas.addMouseListener( l );
for ( final MouseMotionListener l : canvasMouseMotionListeners )
canvas.addMouseMotionListener( l );
for ( final MouseWheelListener l : windowMouseWheelListeners )
window.addMouseWheelListener( l );
for ( final AdjustmentListener l : scrollBarAdjustmentListeners )
scrollBar.addAdjustmentListener( l );
scrollBar.setValues( scrollBarValue, scrollBarVisible, scrollBarMin, scrollBarMax );
}
代码示例来源:origin: mpicbg/mpicbg
@Override
public void run( String arg )
{
ij = IJ.getInstance();
imp = IJ.getImage();
window = imp.getWindow();
canvas = imp.getCanvas();
canvas.addKeyListener( this );
window.addKeyListener( this );
canvas.addMouseMotionListener( this );
canvas.addMouseListener( this );
ij.addKeyListener( this );
init();
imp.getProcessor().snapshot();
Toolbar.getInstance().setTool( Toolbar.RECTANGLE );
painter = new PaintThread();
painter.start();
}
代码示例来源:origin: axtimwalde/mpicbg
@Override
public void run( final String arg )
{
ij = IJ.getInstance();
imp = IJ.getImage();
window = imp.getWindow();
canvas = imp.getCanvas();
canvas.addKeyListener( this );
window.addKeyListener( this );
canvas.addMouseMotionListener( this );
canvas.addMouseListener( this );
ij.addKeyListener( this );
init();
imp.getProcessor().snapshot();
Toolbar.getInstance().setTool( Toolbar.LINE );
painter = new PaintThread();
painter.start();
}
代码示例来源:origin: mpicbg/mpicbg
@Override
public void run( final String arg )
{
ij = IJ.getInstance();
imp = IJ.getImage();
window = imp.getWindow();
canvas = imp.getCanvas();
canvas.addKeyListener( this );
window.addKeyListener( this );
canvas.addMouseMotionListener( this );
canvas.addMouseListener( this );
ij.addKeyListener( this );
init();
imp.getProcessor().snapshot();
Toolbar.getInstance().setTool( Toolbar.LINE );
painter = new PaintThread();
painter.start();
}
代码示例来源:origin: axtimwalde/mpicbg
@Override
public void run( String arg )
{
ij = IJ.getInstance();
imp = IJ.getImage();
window = imp.getWindow();
canvas = imp.getCanvas();
canvas.addKeyListener( this );
window.addKeyListener( this );
canvas.addMouseMotionListener( this );
canvas.addMouseListener( this );
ij.addKeyListener( this );
init();
imp.getProcessor().snapshot();
Toolbar.getInstance().setTool( Toolbar.RECTANGLE );
painter = new PaintThread();
painter.start();
}
代码示例来源:origin: axtimwalde/mpicbg
@Override
public void run( String arg )
{
ij = IJ.getInstance();
imp = IJ.getImage();
if ( imp.getStackSize() < 2 )
{
IJ.error( "This plugin only works on stacks with at least two slices." );
return;
}
window = imp.getWindow();
canvas = imp.getCanvas();
canvas.addKeyListener( this );
window.addKeyListener( this );
canvas.addMouseMotionListener( this );
canvas.addMouseListener( this );
ij.addKeyListener( this );
init();
imp.getProcessor().snapshot();
Toolbar.getInstance().setTool( Toolbar.RECTANGLE );
painter = new PaintThread();
painter.start();
}
代码示例来源:origin: com.projectdarkstar.example.projectsnowman/snowman-world-editor
KeyInput.setProvider(KeyInput.INPUT_AWT);
KeyListener kl = (KeyListener) KeyInput.get();
comp.addKeyListener(kl);
AWTMouseInput.setup(comp, false);
代码示例来源:origin: mpicbg/mpicbg
@Override
public void run( String arg )
{
ij = IJ.getInstance();
imp = IJ.getImage();
if ( imp.getStackSize() < 2 )
{
IJ.error( "This plugin only works on stacks with at least two slices." );
return;
}
window = imp.getWindow();
canvas = imp.getCanvas();
canvas.addKeyListener( this );
window.addKeyListener( this );
canvas.addMouseMotionListener( this );
canvas.addMouseListener( this );
ij.addKeyListener( this );
init();
imp.getProcessor().snapshot();
Toolbar.getInstance().setTool( Toolbar.RECTANGLE );
painter = new PaintThread();
painter.start();
}
内容来源于网络,如有侵权,请联系作者删除!