Java Code Examples for java.awt.im.spi.InputMethodDescriptor#hasDynamicLocaleList()
The following examples show how to use
java.awt.im.spi.InputMethodDescriptor#hasDynamicLocaleList() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InputMethodPopupMenu.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) { InputMethodDescriptor descriptor = locator.getDescriptor(); String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault()); String command = locator.getActionCommandString(); Locale[] locales = null; int localeCount; try { locales = descriptor.getAvailableLocales(); localeCount = locales.length; } catch (AWTException e) { // ??? should have better error handling - // tell user what happened, then remove this input method from the list. // For the time being, just show it disabled. localeCount = 0; } if (localeCount == 0) { // could be IIIMP adapter which has lost its connection addMenuItem(label, null, currentSelection); } else if (localeCount == 1) { if (descriptor.hasDynamicLocaleList()) { // try to make sure that what the user sees and what // we eventually select is consistent even if the locale // list changes in the meantime label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault()); command = locator.deriveLocator(locales[0]).getActionCommandString(); } addMenuItem(label, command, currentSelection); } else { Object submenu = createSubmenu(label); add(submenu); for (int j = 0; j < localeCount; j++) { Locale locale = locales[j]; String subLabel = getLocaleName(locale); String subCommand = locator.deriveLocator(locale).getActionCommandString(); addMenuItem(submenu, subLabel, subCommand, currentSelection); } } }
Example 2
Source File: InputMethodPopupMenu.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) { InputMethodDescriptor descriptor = locator.getDescriptor(); String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault()); String command = locator.getActionCommandString(); Locale[] locales = null; int localeCount; try { locales = descriptor.getAvailableLocales(); localeCount = locales.length; } catch (AWTException e) { // ??? should have better error handling - // tell user what happened, then remove this input method from the list. // For the time being, just show it disabled. localeCount = 0; } if (localeCount == 0) { // could be IIIMP adapter which has lost its connection addMenuItem(label, null, currentSelection); } else if (localeCount == 1) { if (descriptor.hasDynamicLocaleList()) { // try to make sure that what the user sees and what // we eventually select is consistent even if the locale // list changes in the meantime label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault()); command = locator.deriveLocator(locales[0]).getActionCommandString(); } addMenuItem(label, command, currentSelection); } else { Object submenu = createSubmenu(label); add(submenu); for (int j = 0; j < localeCount; j++) { Locale locale = locales[j]; String subLabel = getLocaleName(locale); String subCommand = locator.deriveLocator(locale).getActionCommandString(); addMenuItem(submenu, subLabel, subCommand, currentSelection); } } }
Example 3
Source File: InputMethodPopupMenu.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) { InputMethodDescriptor descriptor = locator.getDescriptor(); String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault()); String command = locator.getActionCommandString(); Locale[] locales = null; int localeCount; try { locales = descriptor.getAvailableLocales(); localeCount = locales.length; } catch (AWTException e) { // ??? should have better error handling - // tell user what happened, then remove this input method from the list. // For the time being, just show it disabled. localeCount = 0; } if (localeCount == 0) { // could be IIIMP adapter which has lost its connection addMenuItem(label, null, currentSelection); } else if (localeCount == 1) { if (descriptor.hasDynamicLocaleList()) { // try to make sure that what the user sees and what // we eventually select is consistent even if the locale // list changes in the meantime label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault()); command = locator.deriveLocator(locales[0]).getActionCommandString(); } addMenuItem(label, command, currentSelection); } else { Object submenu = createSubmenu(label); add(submenu); for (int j = 0; j < localeCount; j++) { Locale locale = locales[j]; String subLabel = getLocaleName(locale); String subCommand = locator.deriveLocator(locale).getActionCommandString(); addMenuItem(submenu, subLabel, subCommand, currentSelection); } } }
Example 4
Source File: InputMethodPopupMenu.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) { InputMethodDescriptor descriptor = locator.getDescriptor(); String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault()); String command = locator.getActionCommandString(); Locale[] locales = null; int localeCount; try { locales = descriptor.getAvailableLocales(); localeCount = locales.length; } catch (AWTException e) { // ??? should have better error handling - // tell user what happened, then remove this input method from the list. // For the time being, just show it disabled. localeCount = 0; } if (localeCount == 0) { // could be IIIMP adapter which has lost its connection addMenuItem(label, null, currentSelection); } else if (localeCount == 1) { if (descriptor.hasDynamicLocaleList()) { // try to make sure that what the user sees and what // we eventually select is consistent even if the locale // list changes in the meantime label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault()); command = locator.deriveLocator(locales[0]).getActionCommandString(); } addMenuItem(label, command, currentSelection); } else { Object submenu = createSubmenu(label); add(submenu); for (int j = 0; j < localeCount; j++) { Locale locale = locales[j]; String subLabel = getLocaleName(locale); String subCommand = locator.deriveLocator(locale).getActionCommandString(); addMenuItem(submenu, subLabel, subCommand, currentSelection); } } }
Example 5
Source File: InputMethodPopupMenu.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) { InputMethodDescriptor descriptor = locator.getDescriptor(); String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault()); String command = locator.getActionCommandString(); Locale[] locales = null; int localeCount; try { locales = descriptor.getAvailableLocales(); localeCount = locales.length; } catch (AWTException e) { // ??? should have better error handling - // tell user what happened, then remove this input method from the list. // For the time being, just show it disabled. localeCount = 0; } if (localeCount == 0) { // could be IIIMP adapter which has lost its connection addMenuItem(label, null, currentSelection); } else if (localeCount == 1) { if (descriptor.hasDynamicLocaleList()) { // try to make sure that what the user sees and what // we eventually select is consistent even if the locale // list changes in the meantime label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault()); command = locator.deriveLocator(locales[0]).getActionCommandString(); } addMenuItem(label, command, currentSelection); } else { Object submenu = createSubmenu(label); add(submenu); for (int j = 0; j < localeCount; j++) { Locale locale = locales[j]; String subLabel = getLocaleName(locale); String subCommand = locator.deriveLocator(locale).getActionCommandString(); addMenuItem(submenu, subLabel, subCommand, currentSelection); } } }
Example 6
Source File: InputMethodPopupMenu.java From Bytecoder with Apache License 2.0 | 5 votes |
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) { InputMethodDescriptor descriptor = locator.getDescriptor(); String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault()); String command = locator.getActionCommandString(); Locale[] locales = null; int localeCount; try { locales = descriptor.getAvailableLocales(); localeCount = locales.length; } catch (AWTException e) { // ??? should have better error handling - // tell user what happened, then remove this input method from the list. // For the time being, just show it disabled. localeCount = 0; } if (localeCount == 0) { // could be IIIMP adapter which has lost its connection addMenuItem(label, null, currentSelection); } else if (localeCount == 1) { if (descriptor.hasDynamicLocaleList()) { // try to make sure that what the user sees and what // we eventually select is consistent even if the locale // list changes in the meantime label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault()); command = locator.deriveLocator(locales[0]).getActionCommandString(); } addMenuItem(label, command, currentSelection); } else { Object submenu = createSubmenu(label); add(submenu); for (int j = 0; j < localeCount; j++) { Locale locale = locales[j]; String subLabel = getLocaleName(locale); String subCommand = locator.deriveLocator(locale).getActionCommandString(); addMenuItem(submenu, subLabel, subCommand, currentSelection); } } }
Example 7
Source File: InputMethodPopupMenu.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) { InputMethodDescriptor descriptor = locator.getDescriptor(); String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault()); String command = locator.getActionCommandString(); Locale[] locales = null; int localeCount; try { locales = descriptor.getAvailableLocales(); localeCount = locales.length; } catch (AWTException e) { // ??? should have better error handling - // tell user what happened, then remove this input method from the list. // For the time being, just show it disabled. localeCount = 0; } if (localeCount == 0) { // could be IIIMP adapter which has lost its connection addMenuItem(label, null, currentSelection); } else if (localeCount == 1) { if (descriptor.hasDynamicLocaleList()) { // try to make sure that what the user sees and what // we eventually select is consistent even if the locale // list changes in the meantime label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault()); command = locator.deriveLocator(locales[0]).getActionCommandString(); } addMenuItem(label, command, currentSelection); } else { Object submenu = createSubmenu(label); add(submenu); for (int j = 0; j < localeCount; j++) { Locale locale = locales[j]; String subLabel = getLocaleName(locale); String subCommand = locator.deriveLocator(locale).getActionCommandString(); addMenuItem(submenu, subLabel, subCommand, currentSelection); } } }
Example 8
Source File: InputMethodPopupMenu.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) { InputMethodDescriptor descriptor = locator.getDescriptor(); String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault()); String command = locator.getActionCommandString(); Locale[] locales = null; int localeCount; try { locales = descriptor.getAvailableLocales(); localeCount = locales.length; } catch (AWTException e) { // ??? should have better error handling - // tell user what happened, then remove this input method from the list. // For the time being, just show it disabled. localeCount = 0; } if (localeCount == 0) { // could be IIIMP adapter which has lost its connection addMenuItem(label, null, currentSelection); } else if (localeCount == 1) { if (descriptor.hasDynamicLocaleList()) { // try to make sure that what the user sees and what // we eventually select is consistent even if the locale // list changes in the meantime label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault()); command = locator.deriveLocator(locales[0]).getActionCommandString(); } addMenuItem(label, command, currentSelection); } else { Object submenu = createSubmenu(label); add(submenu); for (int j = 0; j < localeCount; j++) { Locale locale = locales[j]; String subLabel = getLocaleName(locale); String subCommand = locator.deriveLocator(locale).getActionCommandString(); addMenuItem(submenu, subLabel, subCommand, currentSelection); } } }
Example 9
Source File: InputMethodPopupMenu.java From hottub with GNU General Public License v2.0 | 5 votes |
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) { InputMethodDescriptor descriptor = locator.getDescriptor(); String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault()); String command = locator.getActionCommandString(); Locale[] locales = null; int localeCount; try { locales = descriptor.getAvailableLocales(); localeCount = locales.length; } catch (AWTException e) { // ??? should have better error handling - // tell user what happened, then remove this input method from the list. // For the time being, just show it disabled. localeCount = 0; } if (localeCount == 0) { // could be IIIMP adapter which has lost its connection addMenuItem(label, null, currentSelection); } else if (localeCount == 1) { if (descriptor.hasDynamicLocaleList()) { // try to make sure that what the user sees and what // we eventually select is consistent even if the locale // list changes in the meantime label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault()); command = locator.deriveLocator(locales[0]).getActionCommandString(); } addMenuItem(label, command, currentSelection); } else { Object submenu = createSubmenu(label); add(submenu); for (int j = 0; j < localeCount; j++) { Locale locale = locales[j]; String subLabel = getLocaleName(locale); String subCommand = locator.deriveLocator(locale).getActionCommandString(); addMenuItem(submenu, subLabel, subCommand, currentSelection); } } }
Example 10
Source File: InputMethodPopupMenu.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) { InputMethodDescriptor descriptor = locator.getDescriptor(); String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault()); String command = locator.getActionCommandString(); Locale[] locales = null; int localeCount; try { locales = descriptor.getAvailableLocales(); localeCount = locales.length; } catch (AWTException e) { // ??? should have better error handling - // tell user what happened, then remove this input method from the list. // For the time being, just show it disabled. localeCount = 0; } if (localeCount == 0) { // could be IIIMP adapter which has lost its connection addMenuItem(label, null, currentSelection); } else if (localeCount == 1) { if (descriptor.hasDynamicLocaleList()) { // try to make sure that what the user sees and what // we eventually select is consistent even if the locale // list changes in the meantime label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault()); command = locator.deriveLocator(locales[0]).getActionCommandString(); } addMenuItem(label, command, currentSelection); } else { Object submenu = createSubmenu(label); add(submenu); for (int j = 0; j < localeCount; j++) { Locale locale = locales[j]; String subLabel = getLocaleName(locale); String subCommand = locator.deriveLocator(locale).getActionCommandString(); addMenuItem(submenu, subLabel, subCommand, currentSelection); } } }
Example 11
Source File: InputMethodPopupMenu.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) { InputMethodDescriptor descriptor = locator.getDescriptor(); String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault()); String command = locator.getActionCommandString(); Locale[] locales = null; int localeCount; try { locales = descriptor.getAvailableLocales(); localeCount = locales.length; } catch (AWTException e) { // ??? should have better error handling - // tell user what happened, then remove this input method from the list. // For the time being, just show it disabled. localeCount = 0; } if (localeCount == 0) { // could be IIIMP adapter which has lost its connection addMenuItem(label, null, currentSelection); } else if (localeCount == 1) { if (descriptor.hasDynamicLocaleList()) { // try to make sure that what the user sees and what // we eventually select is consistent even if the locale // list changes in the meantime label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault()); command = locator.deriveLocator(locales[0]).getActionCommandString(); } addMenuItem(label, command, currentSelection); } else { Object submenu = createSubmenu(label); add(submenu); for (int j = 0; j < localeCount; j++) { Locale locale = locales[j]; String subLabel = getLocaleName(locale); String subCommand = locator.deriveLocator(locale).getActionCommandString(); addMenuItem(submenu, subLabel, subCommand, currentSelection); } } }
Example 12
Source File: InputMethodPopupMenu.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) { InputMethodDescriptor descriptor = locator.getDescriptor(); String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault()); String command = locator.getActionCommandString(); Locale[] locales = null; int localeCount; try { locales = descriptor.getAvailableLocales(); localeCount = locales.length; } catch (AWTException e) { // ??? should have better error handling - // tell user what happened, then remove this input method from the list. // For the time being, just show it disabled. localeCount = 0; } if (localeCount == 0) { // could be IIIMP adapter which has lost its connection addMenuItem(label, null, currentSelection); } else if (localeCount == 1) { if (descriptor.hasDynamicLocaleList()) { // try to make sure that what the user sees and what // we eventually select is consistent even if the locale // list changes in the meantime label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault()); command = locator.deriveLocator(locales[0]).getActionCommandString(); } addMenuItem(label, command, currentSelection); } else { Object submenu = createSubmenu(label); add(submenu); for (int j = 0; j < localeCount; j++) { Locale locale = locales[j]; String subLabel = getLocaleName(locale); String subCommand = locator.deriveLocator(locale).getActionCommandString(); addMenuItem(submenu, subLabel, subCommand, currentSelection); } } }
Example 13
Source File: InputMethodPopupMenu.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) { InputMethodDescriptor descriptor = locator.getDescriptor(); String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault()); String command = locator.getActionCommandString(); Locale[] locales = null; int localeCount; try { locales = descriptor.getAvailableLocales(); localeCount = locales.length; } catch (AWTException e) { // ??? should have better error handling - // tell user what happened, then remove this input method from the list. // For the time being, just show it disabled. localeCount = 0; } if (localeCount == 0) { // could be IIIMP adapter which has lost its connection addMenuItem(label, null, currentSelection); } else if (localeCount == 1) { if (descriptor.hasDynamicLocaleList()) { // try to make sure that what the user sees and what // we eventually select is consistent even if the locale // list changes in the meantime label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault()); command = locator.deriveLocator(locales[0]).getActionCommandString(); } addMenuItem(label, command, currentSelection); } else { Object submenu = createSubmenu(label); add(submenu); for (int j = 0; j < localeCount; j++) { Locale locale = locales[j]; String subLabel = getLocaleName(locale); String subCommand = locator.deriveLocator(locale).getActionCommandString(); addMenuItem(submenu, subLabel, subCommand, currentSelection); } } }
Example 14
Source File: InputMethodPopupMenu.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
void addOneInputMethodToMenu(InputMethodLocator locator, String currentSelection) { InputMethodDescriptor descriptor = locator.getDescriptor(); String label = descriptor.getInputMethodDisplayName(null, Locale.getDefault()); String command = locator.getActionCommandString(); Locale[] locales = null; int localeCount; try { locales = descriptor.getAvailableLocales(); localeCount = locales.length; } catch (AWTException e) { // ??? should have better error handling - // tell user what happened, then remove this input method from the list. // For the time being, just show it disabled. localeCount = 0; } if (localeCount == 0) { // could be IIIMP adapter which has lost its connection addMenuItem(label, null, currentSelection); } else if (localeCount == 1) { if (descriptor.hasDynamicLocaleList()) { // try to make sure that what the user sees and what // we eventually select is consistent even if the locale // list changes in the meantime label = descriptor.getInputMethodDisplayName(locales[0], Locale.getDefault()); command = locator.deriveLocator(locales[0]).getActionCommandString(); } addMenuItem(label, command, currentSelection); } else { Object submenu = createSubmenu(label); add(submenu); for (int j = 0; j < localeCount; j++) { Locale locale = locales[j]; String subLabel = getLocaleName(locale); String subCommand = locator.deriveLocator(locale).getActionCommandString(); addMenuItem(submenu, subLabel, subCommand, currentSelection); } } }