Packages
 In this topic

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.util.InputMethod   Previous This
Package
Next

 


Interface InputMethodListener

public interface InputMethodListener
{
  // Methods
  public void activate() ;
  public void deactivate() ;
  public String getName() ;
  public boolean handledKey( InputMethodCallback imeCallback,
        long when, int keyCode, int keyChar, int state) ;
  public void handleIMEMessage( InputMethodMessage IMEMessage ) ;
  public void paint(Graphics g) ;
  public void setFont( Font font ) ;
  public void setPos(int x, int y) ;
  public void setVisibleComponent(Component c) ;
  public void setVisibleComponent( IUIComponent c) ;
  public Dimension size(Graphics g) ;
}

This class must be implemented by Input Method Editors (IMEs) to be used with Java applications.

Methods

activate

public void activate() ;

Activates the IME. You must call this method to activate the IME because the IME will never receive focus and be activated by using focus methods.

Return Value:

No return value.

Remarks:

Currently, this method is not implemented.

deactivate

public void deactivate() ;

Deactivates the IME. You must call this method to deactivate the IME because the IME will never receive or lose focus and be deactivated by using focus methods.

Return Value:

No return value.

Remarks:

Currently, this method is not implemented.

getName

public String getName() ;

Retrieves the localized name of the IME. The IME should call Locale.getDefault() to determine the current locale, and return the localized name according to the locale. However, if the IME does not have a name corresponding to the current locale, it should return a language-netural name of the IME, generally in English.

Return Value:

Returns the localized name of the IME.

handledKey

public boolean handledKey( InputMethodCallback imeCallback, long when,
        int keyCode, int keyChar, int state) ;

Called by the InputManagerListener. The InputManagerListener passes the keystroke to the InputMethodListener object by calling this method.

If the InputMethodListener object accepts the keystroke, it returns true and the keystroke never returns to the internal input queue. If the return value is false, this keystroke is returned to the internal input queue.

Return Value:

Returns true if InputMethodListener processes the keystroke; otherwise, returns false.

ParameterDescription
imeCallback The InputMethodCallback object that receives keystrokes from the native system.
when The time that the composed character is generated.
keyCode The ASCII key code of the character.
keyChar The key character of the composed character.
state The state when the event occurred.

handleIMEMessage

public void handleIMEMessage( InputMethodMessage IMEMessage ) ;

Handles an IME Message. The IME will first send any IME messages generated by itself to InputMethodCallback. handleIMEMessage. This gives the application a chance to handle IME messages (to reposition the IME windows, for example).

However, if the handleIMEMessage method in the application which implements the InputMethodMessageListener returns false, the InputMethodCallback will forward these IME messages back into this method. In this way the InputMethodListener can listen to these messages and repaint the default IME user interface.

Return Value:

No return value

ParameterDescription
IMEMessage The InputMethodMessage that is processed.

paint

public void paint(Graphics g) ;

Paints the object on a specific graphic object.

Return Value:

No return value.

ParameterDescription
g The Graphics object used to paint.

Remarks:

Currently, this method is not implemented.

setFont

public void setFont( Font font ) ;

Sets the font used in composition window.

Return Value:

No return value.

ParameterDescription
font The Font used in the composition window.

setPos

public void setPos(int x, int y) ;

Displays the IME composition window on the visible canvas in terms of (x,y) coordinates. When the IME is attached to a component, the position of the composition window will be set in the client area of the component.

Return Value:

No return value.

ParameterDescription
x The x coordinate of the position of the IME composition window.
y The y coordinate of the position of the IME composition window.

Remarks:

Currently, this method is not implemented.

setVisibleComponent

public void setVisibleComponent(Component c) ;

Sets the component c as the component where the IME is seen on the screen. This component does not have to be an independent window, but it can be attached to the input window.

Return Value:

No return value.

ParameterDescription
c The component that displays the IME on the screen.

setVisibleComponent

public void setVisibleComponent( IUIComponent c) ;

Sets the component c as the component where the IME is seen on the screen. This component does not have to be an independent window, but it can be attached to the input window.

Return Value:

No return value.

ParameterDescription
c The component that displays the IME on the screen.

size

public Dimension size(Graphics g) ;

Retrieves the current size of the area required to draw the IME, using the given graphics object. This method enables the caller to set text fonts and colors.

Return Value:

Returns null, by default.

ParameterDescription
g The Graphics object used to determine the size of the IME.

Remarks:

Currently, this method is not implemented.

upnrm.gif © 1998 Microsoft Corporation. All rights reserved. Terms of use.