Book Home Java Enterprise in a Nutshell Search this book

Chapter 17. The Package

The package contains classes and interfaces used by input methods and by the text-editing user interface components that interact with input methods. Most applications rely on GUI components that have input method support built in and do not need to use this package directly. In other words, input method details are usually hidden by text input components, and application-level code should never have to use these classes and interfaces. Figure 17-1 shows the class hierarchy of this package, which is new in Java 1.2.


Figure 17-1. The package

InputContextJava 1.2

This class serves as an intermediary between input methods and the text input components that use them. An InputContext stores the state related to one pending text composition operation. By default, there is one InputContext per Window. Components can obtain this shared input context with the Component.getInputContext() method. Components that need a private InputContext can create their own with InputContext.getInstance().

public class InputContext {
// Protected Constructors
protected InputContext ();
// Public Class Methods
public static InputContext getInstance ();
// Property Accessor Methods (by property name)
public Object getInputMethodControlObject (); constant
// Public Instance Methods
public void dispatchEvent (AWTEvent event); synchronized empty
public void dispose (); empty
public void endComposition (); synchronized empty
public void removeNotify (Component client); empty
public boolean selectInputMethod (java.util.Locale locale); constant
public void setCharacterSubsets (Character.Subset[ ] subsets); empty

Returned By: Component.getInputContext(), Window.getInputContext(), InputContext.getInstance()

InputMethodHighlightJava 1.2

This class defines the highlighted or unhighlighted state of text being processed by an input method. For input methods, highlighting can be used to distinguish converted from unconverted text, as well as to distinguish selected from unselected text. InputMethodHighlight objects are used as attribute values returned by java.text.AttributedCharacterIterator objects. Note the various InputMethodHighlight constants predefined by this class.

public class InputMethodHighlight {
// Public Constructors
public InputMethodHighlight (boolean selected, int state);
public InputMethodHighlight (boolean selected, int state, int variation);
// Public Constants
public static final int CONVERTED_TEXT ; =1
public static final int RAW_TEXT ; =0
public static final InputMethodHighlight SELECTED_CONVERTED_TEXT_HIGHLIGHT ;
public static final InputMethodHighlight SELECTED_RAW_TEXT_HIGHLIGHT ;
public static final InputMethodHighlight UNSELECTED_CONVERTED_TEXT_HIGHLIGHT ;
public static final InputMethodHighlight UNSELECTED_RAW_TEXT_HIGHLIGHT ;
// Public Instance Methods
public int getState ();
public int getVariation ();
public boolean isSelected ();


InputMethodRequestsJava 1.2

This interface defines the methods that a component must implement in order to accept text input from input methods. A component need not implement these methods directly, but it must return an object that implements this interface from a getInputMethodRequests() method.

public abstract interface InputMethodRequests {
// Public Instance Methods
public abstract java.text.AttributedCharacterIterator cancelLatestCommittedText (java.text.AttributedCharacterIterator.Attribute[ ] attributes);
public abstract java.text.AttributedCharacterIterator getCommittedText (int beginIndex, int endIndex, java.text.AttributedCharacterIterator.Attribute[ ] attributes);
public abstract int getCommittedTextLength ();
public abstract int getInsertPositionOffset ();
public abstract java.awt.font.TextHitInfo getLocationOffset (int x, int y);
public abstract java.text.AttributedCharacterIterator getSelectedText (java.text.AttributedCharacterIterator.Attribute[ ] attributes);
public abstract Rectangle getTextLocation (java.awt.font.TextHitInfo offset);

Returned By: Component.getInputMethodRequests(), javax.swing.text.JTextComponent.getInputMethodRequests()

InputSubsetJava 1.2

This class defines Character$Subset constants that are useful to input methods.

public final class InputSubset extends Character.Subset {
// No Constructor
// Public Constants
public static final InputSubset HALFWIDTH_KATAKANA ;
public static final InputSubset HANJA ;
public static final InputSubset KANJI ;
public static final InputSubset LATIN ;
public static final InputSubset LATIN_DIGITS ;
public static final InputSubset SIMPLIFIED_HANZI ;
public static final InputSubset TRADITIONAL_HANZI ;

Hierarchy: Object-->Character.Subset-->InputSubset


Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.