1. /*
  2. * @(#)InputMethodContext.java 1.9 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package java.awt.im.spi;
  11. import java.awt.Window;
  12. import java.awt.font.TextHitInfo;
  13. import java.awt.im.InputMethodRequests;
  14. import java.text.AttributedCharacterIterator;
  15. /**
  16. * Provides methods that input methods
  17. * can use to communicate with their client components or to request
  18. * other services.
  19. *
  20. * @since 1.3
  21. *
  22. * @version 1.9, 02/02/00
  23. * @author JavaSoft International
  24. */
  25. public interface InputMethodContext extends InputMethodRequests {
  26. /**
  27. * Creates an input method event from the arguments given
  28. * and dispatches it to the client component. For arguments,
  29. * see {@link java.awt.event.InputMethodEvent#InputMethodEvent}.
  30. */
  31. public void dispatchInputMethodEvent(int id,
  32. AttributedCharacterIterator text, int committedCharacterCount,
  33. TextHitInfo caret, TextHitInfo visiblePosition);
  34. /**
  35. * Creates a top-level window for use by the input method.
  36. * The intended behavior of this window is:
  37. * <ul>
  38. * <li>it floats above all document windows and dialogs
  39. * <li>it and all components that it contains do not receive the focus
  40. * <li>it has lightweight decorations, such as a reduced drag region without title
  41. * </ul>
  42. * However, the actual behavior with respect to these three items is platform dependent.
  43. * <p>
  44. * The title may or may not be displayed, depending on the actual type of window created.
  45. * <p>
  46. * If attachToInputContext is true, the new window will share the input context that
  47. * corresponds to this input method context, so that events for components in the window
  48. * are automatically dispatched to the input method.
  49. * Also, when the window is opened using setVisible(true), the input context will prevent
  50. * deactivate and activate calls to the input method that might otherwise be caused.
  51. * <p>
  52. * @param title the title to be displayed in the window's title bar,
  53. * if there is such a title bar.
  54. * A <code>null</code> value is treated as an empty string, "".
  55. * @param attachToInputContext whether this window should share the input context
  56. * that corresponds to this input method context
  57. * @return a window with special characteristics for use by input methods
  58. */
  59. public Window createInputMethodWindow(String title, boolean attachToInputContext);
  60. /**
  61. * Enables or disables notification of the current client window's
  62. * location and state for the specified input method. When
  63. * notification is enabled, the input method's {@link
  64. * java.awt.im.spi.InputMethod#notifyClientWindowChange
  65. * notifyClientWindowChange} method is called as described in that
  66. * method's specification. Notification is automatically disabled
  67. * when the input method is disposed.
  68. *
  69. * @param inputMethod the input method for which notifications are
  70. * enabled or disabled
  71. * @param enable true to enable, false to disable
  72. */
  73. public void enableClientWindowNotification(InputMethod inputMethod, boolean enable);
  74. }