KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > im > spi > InputMethodContext


1 /*
2  * @(#)InputMethodContext.java 1.16 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.awt.im.spi;
9
10 import java.awt.HeadlessException JavaDoc;
11 import java.awt.Window JavaDoc;
12 import java.awt.font.TextHitInfo JavaDoc;
13 import java.awt.im.InputMethodRequests JavaDoc;
14 import java.text.AttributedCharacterIterator JavaDoc;
15 import javax.swing.JFrame JavaDoc;
16
17 /**
18  * Provides methods that input methods
19  * can use to communicate with their client components or to request
20  * other services. This interface is implemented by the input method
21  * framework, and input methods call its methods on the instance they
22  * receive through
23  * {@link java.awt.im.spi.InputMethod#setInputMethodContext}.
24  * There should be no other implementors or callers.
25  *
26  * @since 1.3
27  *
28  * @version 1.16, 12/19/03
29  * @author JavaSoft International
30  */

31
32 public interface InputMethodContext extends InputMethodRequests JavaDoc {
33
34     /**
35      * Creates an input method event from the arguments given
36      * and dispatches it to the client component. For arguments,
37      * see {@link java.awt.event.InputMethodEvent#InputMethodEvent}.
38      */

39     public void dispatchInputMethodEvent(int id,
40                 AttributedCharacterIterator JavaDoc text, int committedCharacterCount,
41                 TextHitInfo JavaDoc caret, TextHitInfo JavaDoc visiblePosition);
42
43     /**
44      * Creates a top-level window for use by the input method.
45      * The intended behavior of this window is:
46      * <ul>
47      * <li>it floats above all document windows and dialogs
48      * <li>it and all components that it contains do not receive the focus
49      * <li>it has lightweight decorations, such as a reduced drag region without title
50      * </ul>
51      * However, the actual behavior with respect to these three items is platform dependent.
52      * <p>
53      * The title may or may not be displayed, depending on the actual type of window created.
54      * <p>
55      * If attachToInputContext is true, the new window will share the input context that
56      * corresponds to this input method context, so that events for components in the window
57      * are automatically dispatched to the input method.
58      * Also, when the window is opened using setVisible(true), the input context will prevent
59      * deactivate and activate calls to the input method that might otherwise be caused.
60      * <p>
61      * Input methods must call {@link java.awt.Window#dispose() Window.dispose} on the
62      * returned input method window when it is no longer needed.
63      * <p>
64      * @param title the title to be displayed in the window's title bar,
65      * if there is such a title bar.
66      * A <code>null</code> value is treated as an empty string, "".
67      * @param attachToInputContext whether this window should share the input context
68      * that corresponds to this input method context
69      * @return a window with special characteristics for use by input methods
70      * @exception HeadlessException if <code>GraphicsEnvironment.isHeadless
71      * </code> returns <code>true</code>
72      */

73     public Window JavaDoc createInputMethodWindow(String JavaDoc title, boolean attachToInputContext);
74
75     /**
76      * Creates a top-level Swing JFrame for use by the input method.
77      * The intended behavior of this window is:
78      * <ul>
79      * <li>it floats above all document windows and dialogs
80      * <li>it and all components that it contains do not receive the focus
81      * <li>it has lightweight decorations, such as a reduced drag region without title
82      * </ul>
83      * However, the actual behavior with respect to these three items is platform dependent.
84      * <p>
85      * The title may or may not be displayed, depending on the actual type of window created.
86      * <p>
87      * If attachToInputContext is true, the new window will share the input context that
88      * corresponds to this input method context, so that events for components in the window
89      * are automatically dispatched to the input method.
90      * Also, when the window is opened using setVisible(true), the input context will prevent
91      * deactivate and activate calls to the input method that might otherwise be caused.
92      * <p>
93      * Input methods must call {@link java.awt.Window#dispose() Window.dispose} on the
94      * returned input method window when it is no longer needed.
95      * <p>
96      * @param title the title to be displayed in the window's title bar,
97      * if there is such a title bar.
98      * A <code>null</code> value is treated as an empty string, "".
99      * @param attachToInputContext whether this window should share the input context
100      * that corresponds to this input method context
101      * @return a JFrame with special characteristics for use by input methods
102      * @exception HeadlessException if <code>GraphicsEnvironment.isHeadless
103      * </code> returns <code>true</code>
104      *
105      * @since 1.4
106      */

107     public JFrame JavaDoc createInputMethodJFrame(String JavaDoc title, boolean attachToInputContext);
108
109     /**
110      * Enables or disables notification of the current client window's
111      * location and state for the specified input method. When
112      * notification is enabled, the input method's {@link
113      * java.awt.im.spi.InputMethod#notifyClientWindowChange
114      * notifyClientWindowChange} method is called as described in that
115      * method's specification. Notification is automatically disabled
116      * when the input method is disposed.
117      *
118      * @param inputMethod the input method for which notifications are
119      * enabled or disabled
120      * @param enable true to enable, false to disable
121      */

122     public void enableClientWindowNotification(InputMethod JavaDoc inputMethod, boolean enable);
123 }
124
Popular Tags