Java Doc for InputContext.java in  » 6.0-JDK-Modules » j2me » java » awt » im » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » java.awt.im 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.awt.im.InputContext

All known Subclasses:   sun.awt.im.InputContext,
InputContext
public class InputContext (Code)
Provides methods to control text input facilities such as input methods and keyboard layouts. Two methods handle both input methods and keyboard layouts: selectInputMethod lets a client component select an input method or keyboard layout by locale, getLocale lets a client component obtain the locale of the current input method or keyboard layout. The other methods more specifically support interaction with input methods: They let client components control the behavior of input methods, and dispatch events from the client component to the input method.

By default, one InputContext instance is created per Window instance, and this input context is shared by all components within the window's container hierarchy. However, this means that only one text input operation is possible at any one time within a window, and that the text needs to be committed when moving the focus from one text component to another. If this is not desired, text components can create their own input context instances.

The Java 2 platform supports input methods that have been developed in the Java programming language, using the interfaces in the sun.awt.im.spi package, and installed into a Java 2 runtime environment as extensions. Implementations may also support using the native input methods of the platforms they run on; however, not all platforms and locales provide input methods. Keyboard layouts are provided by the host platform.

Input methods are unavailable if (a) no input method written in the Java programming language has been installed and (b) the Java 2 implementation or the underlying platform does not support native input methods. In this case, input contexts can still be created and used; their behavior is specified with the individual methods below.
See Also:   java.awt.Component.getInputContext
See Also:   java.awt.Component.enableInputMethods
version:
   1.33, 02/17/04
author:
   JavaSoft Asia/Pacific
since:
   1.2




Constructor Summary
protected  InputContext()
     Constructs an InputContext. This method is protected so clients cannot instantiate InputContext directly.

Method Summary
public  voiddispatchEvent(AWTEvent event)
     Dispatches an event to the active input method.
public  voiddispose()
     Disposes of the input context and release the resources used by it.
public  voidendComposition()
     Ends any input composition that may currently be going on in this context.
public  ObjectgetInputMethodControlObject()
     Returns a control object from the current input method, or null.
public static  InputContextgetInstance()
     Returns a new InputContext instance.
public  LocalegetLocale()
     Returns the current locale of the current input method or keyboard layout.
public  booleanisCompositionEnabled()
     Determines whether the current input method is enabled for composition.
public  voidreconvert()
     Asks the current input method to reconvert text from the current client component.
public  voidremoveNotify(Component client)
     Notifies the input context that a client component has been removed from its containment hierarchy, or that input method support has been disabled for the component.
public  booleanselectInputMethod(Locale locale)
     Attempts to select an input method or keyboard layout that supports the given locale, and returns a value indicating whether such an input method or keyboard layout has been successfully selected.
public  voidsetCharacterSubsets(Subset[] subsets)
     Sets the subsets of the Unicode character set that input methods of this input context should be allowed to input.
public  voidsetCompositionEnabled(boolean enable)
     Enables or disables the current input method for composition, depending on the value of the parameter enable.


Constructor Detail
InputContext
protected InputContext()(Code)
Constructs an InputContext. This method is protected so clients cannot instantiate InputContext directly. Input contexts are obtained by calling InputContext.getInstance .




Method Detail
dispatchEvent
public void dispatchEvent(AWTEvent event)(Code)
Dispatches an event to the active input method. Called by AWT. If no input method is available, then the event will never be consumed.
Parameters:
  event - The event
exception:
  NullPointerException - if event is null



dispose
public void dispose()(Code)
Disposes of the input context and release the resources used by it. Called by AWT for the default input context of each Window. If no input methods are available, then this method has no effect.



endComposition
public void endComposition()(Code)
Ends any input composition that may currently be going on in this context. Depending on the platform and possibly user preferences, this may commit or delete uncommitted text. Any changes to the text are communicated to the active component using an input method event. If no input methods are available, then this method has no effect.

A text editing component may call this in a variety of situations, for example, when the user moves the insertion point within the text (but outside the composed text), or when the component's text is saved to a file or copied to the clipboard.




getInputMethodControlObject
public Object getInputMethodControlObject()(Code)
Returns a control object from the current input method, or null. A control object provides methods that control the behavior of the input method or obtain information from the input method. The type of the object is an input method specific class. Clients have to compare the result against known input method control object classes and cast to the appropriate class to invoke the methods provided.

If no input methods are available or the current input method does not provide an input method control object, then null is returned. A control object from the current input method, or null.




getInstance
public static InputContext getInstance()(Code)
Returns a new InputContext instance.



getLocale
public Locale getLocale()(Code)
Returns the current locale of the current input method or keyboard layout. Returns null if the input context does not have a current input method or keyboard layout or if the current input method's sun.awt.im.spi.InputMethod.getLocale method returns null.

Not all host operating systems provide API to determine the locale of the currently selected native input method or keyboard layout. For host operating systems that don't provide such API, getLocale assumes that the current locale of all native input methods or keyboard layouts provided by the host operating system is the system's default locale. the current locale of the current input method or keyboard layout
since:
   1.3




isCompositionEnabled
public boolean isCompositionEnabled()(Code)
Determines whether the current input method is enabled for composition. An input method that is enabled for composition interprets incoming events for both composition and control purposes, while a disabled input method does not interpret events for composition. true if the current input method is enabled forcomposition; false otherwise
throws:
  UnsupportedOperationException - if there is no current inputmethod available or the current input method does not supportchecking whether it is enabled for composition
See Also:   InputContext.setCompositionEnabled
since:
   1.3



reconvert
public void reconvert()(Code)
Asks the current input method to reconvert text from the current client component. The input method obtains the text to be reconverted from the client component using the InputMethodRequests.getSelectedText InputMethodRequests.getSelectedText method. The other InputMethodRequests methods must be prepared to deal with further information requests by the input method. The composed and/or committed text will be sent to the client component as a sequence of InputMethodEvents. If the input method cannot reconvert the given text, the text is returned as committed text in an InputMethodEvent.
throws:
  UnsupportedOperationException - if there is no current inputmethod available or the current input method does not supportthe reconversion operation.
since:
   1.3



removeNotify
public void removeNotify(Component client)(Code)
Notifies the input context that a client component has been removed from its containment hierarchy, or that input method support has been disabled for the component. This method is usually called from the client component's java.awt.Component.removeNotify Component.removeNotify method. Potentially pending input from input methods for this component is discarded. If no input methods are available, then this method has no effect.
Parameters:
  client - Client component
exception:
  NullPointerException - if client is null



selectInputMethod
public boolean selectInputMethod(Locale locale)(Code)
Attempts to select an input method or keyboard layout that supports the given locale, and returns a value indicating whether such an input method or keyboard layout has been successfully selected. The following steps are taken until an input method has been selected:

  • If the currently selected input method or keyboard layout supports the requested locale, it remains selected.
  • If there is no input method or keyboard layout available that supports the requested locale, the current input method or keyboard layout remains selected.
  • If the user has previously selected an input method or keyboard layout for the requested locale from the user interface, then the most recently selected such input method or keyboard layout is reselected.
  • Otherwise, an input method or keyboard layout that supports the requested locale is selected in an implementation dependent way.
Before switching away from an input method, any currently uncommitted text is committed. If no input method or keyboard layout supporting the requested locale is available, then false is returned.

Not all host operating systems provide API to determine the locale of the currently selected native input method or keyboard layout, and to select a native input method or keyboard layout by locale. For host operating systems that don't provide such API, selectInputMethod assumes that native input methods or keyboard layouts provided by the host operating system support only the system's default locale.

A text editing component may call this method, for example, when the user changes the insertion point, so that the user can immediately continue typing in the language of the surrounding text.
Parameters:
  locale - The desired new locale. true if the input method or keyboard layout that's active afterthis call supports the desired locale.
exception:
  NullPointerException - if locale is null




setCharacterSubsets
public void setCharacterSubsets(Subset[] subsets)(Code)
Sets the subsets of the Unicode character set that input methods of this input context should be allowed to input. Null may be passed in to indicate that all characters are allowed. The initial value is null. The setting applies to the current input method as well as input methods selected after this call is made. However, applications cannot rely on this call having the desired effect, since this setting cannot be passed on to all host input methods - applications still need to apply their own character validation. If no input methods are available, then this method has no effect.
Parameters:
  subsets - The subsets of the Unicode character set from which characters may be input



setCompositionEnabled
public void setCompositionEnabled(boolean enable)(Code)
Enables or disables the current input method for composition, depending on the value of the parameter enable.

An input method that is enabled for composition interprets incoming events for both composition and control purposes, while a disabled input method does not interpret events for composition. Note however that events are passed on to the input method regardless whether it is enabled or not, and that an input method that is disabled for composition may still interpret events for control purposes, including to enable or disable itself for composition.
Parameters:
  enable - whether to enable the current input method for composition
throws:
  UnsupportedOperationException - if there is no current inputmethod available or the current input method does not supportthe enabling/disabling operation
See Also:   InputContext.isCompositionEnabled
since:
   1.3




Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.