Bridges > Java Export Bridge > Appendix - IDL Java Object API > JIDLKeyListener

# JIDLKeyListener

## Declaration

public interface JIDLKeyListener

## All Known Implementing Classes:

JIDLCanvas

## Description

The listener interface for receiving keyboard events (key pressed, key released) on a JIDLCanvas.

The class that is interested in handling these events implements this interface (and all the methods it contains). The listener object created from that class is then registered with the JIDLCanvas using the addIDLKeyListener method. The listener is unregistered with the removeIDLKeyListener.

The JIDLCanvas automatically handles key events whether a program registers an additional JIDLKeyListener or not. The JIDLCanvas is itself a JIDLKeyListener and provides default behavior for press and release. For a key press or key release, the default behavior is for the JIDLCanvas to call the IDL program’s OnKeyboard method.

Note: Clients should not register to listen to JIDLCanvas KeyEvents using a KeyListener, preferring the JIDLKeyListener instead.

#### See Also:

JIDLCanvas, java.awt.event.KeyEvent, java.awt.event.KeyListener

### Member Summary

#### Methods

##### void

IDLkeyPressed(JIDLObjectI obj, java.awt.event.KeyEvent event, int x, int y)

A key press has occurred inside the JIDLCanvas.

##### void

IDLkeyReleased(JIDLObjectI obj, java.awt.event.KeyEvent event, int x, int y)

A key release has occurred inside the JIDLCanvas.

## Methods

### IDLkeyPressed(JIDLObjectI, KeyEvent, int, int)

public void IDLkeyPressed(com.idl.javaidl.JIDLObjectI obj, java.awt.event.KeyEvent event, int x, int y)

A key press has occurred inside the JIDLCanvas.

The default behavior of JIDLCanvas’s default implementation is to call the IDL program’s OnKeyboard method.

#### Parameters:

obj - The JIDLCanvas in which the event occurred.

event - The key event

x - The x pixel location in the canvas where the event occurred

y - The y pixel location in the canvas where the event occurred

### IDLkeyReleased(JIDLObjectI, KeyEvent, int, int)

public void IDLkeyReleased(com.idl.javaidl.JIDLObjectI obj, java.awt.event.KeyEvent event, int x, int y)

A key release has occurred inside the JIDLCanvas.

The default behavior of JIDLCanvas’s default implementation is to call the IDL program’s OnKeyboard method.

#### Parameters:

obj - The JIDLCanvas in which the event occurred.

event - The key event

x - The x pixel location in the canvas where the event occurred

y - The y pixel location in the canvas where the event occurred