static Window createInputMethodWindow(String title, InputContext context, boolean isSwing) { if (GraphicsEnvironment.isHeadless()) { throw new HeadlessException(); } if (isSwing) { return new InputMethodJFrame(title, context); } else { Toolkit toolkit = Toolkit.getDefaultToolkit(); if (toolkit instanceof InputMethodSupport) { return ((InputMethodSupport)toolkit).createInputMethodWindow( title, context); } } throw new InternalError("Input methods must be supported"); }
private void enableInputMethodsIfNecessary() { if (checkForEnableIM) { checkForEnableIM = false; try { Toolkit toolkit = Toolkit.getDefaultToolkit(); boolean shouldEnable = false; if (toolkit instanceof InputMethodSupport) { shouldEnable = ((InputMethodSupport)toolkit) .enableInputMethodsForTextComponent(); } enableInputMethods(shouldEnable); } catch (Exception e) { // if something bad happens, just don't enable input methods } } }
ExecutableInputMethodManager() { // set up host adapter locator Toolkit toolkit = Toolkit.getDefaultToolkit(); try { if (toolkit instanceof InputMethodSupport) { InputMethodDescriptor hostAdapterDescriptor = ((InputMethodSupport)toolkit) .getInputMethodAdapterDescriptor(); if (hostAdapterDescriptor != null) { hostAdapterLocator = new InputMethodLocator(hostAdapterDescriptor, null, null); } } } catch (AWTException e) { // if we can't get a descriptor, we'll just have to do without native input methods } javaInputMethodLocatorList = new Vector<InputMethodLocator>(); initializeInputMethodLocatorList(); }
Locale getDefaultKeyboardLocale() { Toolkit toolkit = Toolkit.getDefaultToolkit(); if (toolkit instanceof InputMethodSupport) { return ((InputMethodSupport)toolkit).getDefaultKeyboardLocale(); } else { return Locale.getDefault(); } }