Java Code Examples for java.awt.Toolkit#getProperty()

The following examples show how to use java.awt.Toolkit#getProperty() . 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: CompositionArea.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
CompositionArea() {
    // create composition window with localized title
    String windowTitle = Toolkit.getProperty("AWT.CompositionWindowTitle", "Input Window");
    compositionWindow =
        (JFrame)InputMethodContext.createInputMethodWindow(windowTitle, null, true);

    setOpaque(true);
    setBorder(LineBorder.createGrayLineBorder());
    setForeground(Color.black);
    setBackground(Color.white);

    // if we get the focus, we still want to let the client's
    // input context handle the event
    enableInputMethods(true);
    enableEvents(AWTEvent.KEY_EVENT_MASK);

    compositionWindow.getContentPane().add(this);
    compositionWindow.addWindowListener(new FrameWindowAdapter());
    addInputMethodListener(this);
    compositionWindow.enableInputMethods(false);
    compositionWindow.pack();
    Dimension windowSize = compositionWindow.getSize();
    Dimension screenSize = (getToolkit()).getScreenSize();
    compositionWindow.setLocation(screenSize.width - windowSize.width-20,
                                screenSize.height - windowSize.height-100);
    compositionWindow.setVisible(false);
}
 
Example 2
Source File: CompositionArea.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
CompositionArea() {
    // create composition window with localized title
    String windowTitle = Toolkit.getProperty("AWT.CompositionWindowTitle", "Input Window");
    compositionWindow =
        (JFrame)InputMethodContext.createInputMethodWindow(windowTitle, null, true);

    setOpaque(true);
    setBorder(LineBorder.createGrayLineBorder());
    setForeground(Color.black);
    setBackground(Color.white);

    // if we get the focus, we still want to let the client's
    // input context handle the event
    enableInputMethods(true);
    enableEvents(AWTEvent.KEY_EVENT_MASK);

    compositionWindow.getContentPane().add(this);
    compositionWindow.addWindowListener(new FrameWindowAdapter());
    addInputMethodListener(this);
    compositionWindow.enableInputMethods(false);
    compositionWindow.pack();
    Dimension windowSize = compositionWindow.getSize();
    Dimension screenSize = (getToolkit()).getScreenSize();
    compositionWindow.setLocation(screenSize.width - windowSize.width-20,
                                screenSize.height - windowSize.height-100);
    compositionWindow.setVisible(false);
}
 
Example 3
Source File: X11InputMethodDescriptor.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodDisplayName
 */
public synchronized String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) {
    // We ignore the input locale.
    // When displaying for the default locale, rely on the localized AWT properties;
    // for any other locale, fall back to English.
    String name = "System Input Methods";
    if (Locale.getDefault().equals(displayLanguage)) {
        name = Toolkit.getProperty("AWT.HostInputMethodDisplayName", name);
    }
    return name;
}
 
Example 4
Source File: X11InputMethodDescriptor.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodDisplayName
 */
public synchronized String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) {
    // We ignore the input locale.
    // When displaying for the default locale, rely on the localized AWT properties;
    // for any other locale, fall back to English.
    String name = "System Input Methods";
    if (Locale.getDefault().equals(displayLanguage)) {
        name = Toolkit.getProperty("AWT.HostInputMethodDisplayName", name);
    }
    return name;
}
 
Example 5
Source File: CompositionArea.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
CompositionArea() {
    // create composition window with localized title
    String windowTitle = Toolkit.getProperty("AWT.CompositionWindowTitle", "Input Window");
    compositionWindow =
        (JFrame)InputMethodContext.createInputMethodWindow(windowTitle, null, true);

    setOpaque(true);
    setBorder(LineBorder.createGrayLineBorder());
    setForeground(Color.black);
    setBackground(Color.white);

    // if we get the focus, we still want to let the client's
    // input context handle the event
    enableInputMethods(true);
    enableEvents(AWTEvent.KEY_EVENT_MASK);

    compositionWindow.getContentPane().add(this);
    compositionWindow.addWindowListener(new FrameWindowAdapter());
    addInputMethodListener(this);
    compositionWindow.enableInputMethods(false);
    compositionWindow.pack();
    Dimension windowSize = compositionWindow.getSize();
    Dimension screenSize = (getToolkit()).getScreenSize();
    compositionWindow.setLocation(screenSize.width - windowSize.width-20,
                                screenSize.height - windowSize.height-100);
    compositionWindow.setVisible(false);
}
 
Example 6
Source File: WInputMethodDescriptor.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodDisplayName
 */
@Override
public synchronized String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) {
    // We ignore the input locale.
    // When displaying for the default locale, rely on the localized AWT properties;
    // for any other locale, fall back to English.
    String name = "System Input Methods";
    if (Locale.getDefault().equals(displayLanguage)) {
        name = Toolkit.getProperty("AWT.HostInputMethodDisplayName", name);
    }
    return name;
}
 
Example 7
Source File: CompositionArea.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
CompositionArea() {
    // create composition window with localized title
    String windowTitle = Toolkit.getProperty("AWT.CompositionWindowTitle", "Input Window");
    compositionWindow =
        (JFrame)InputMethodContext.createInputMethodWindow(windowTitle, null, true);

    setOpaque(true);
    setBorder(LineBorder.createGrayLineBorder());
    setForeground(Color.black);
    setBackground(Color.white);

    // if we get the focus, we still want to let the client's
    // input context handle the event
    enableInputMethods(true);
    enableEvents(AWTEvent.KEY_EVENT_MASK);

    compositionWindow.getContentPane().add(this);
    compositionWindow.addWindowListener(new FrameWindowAdapter());
    addInputMethodListener(this);
    compositionWindow.enableInputMethods(false);
    compositionWindow.pack();
    Dimension windowSize = compositionWindow.getSize();
    Dimension screenSize = (getToolkit()).getScreenSize();
    compositionWindow.setLocation(screenSize.width - windowSize.width-20,
                                screenSize.height - windowSize.height-100);
    compositionWindow.setVisible(false);
}
 
Example 8
Source File: X11InputMethodDescriptor.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodDisplayName
 */
public synchronized String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) {
    // We ignore the input locale.
    // When displaying for the default locale, rely on the localized AWT properties;
    // for any other locale, fall back to English.
    String name = "System Input Methods";
    if (Locale.getDefault().equals(displayLanguage)) {
        name = Toolkit.getProperty("AWT.HostInputMethodDisplayName", name);
    }
    return name;
}
 
Example 9
Source File: InputContext.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void logCreationFailed(Throwable throwable) {
    PlatformLogger logger = PlatformLogger.getLogger("sun.awt.im");
    if (logger.isLoggable(PlatformLogger.Level.CONFIG)) {
        String errorTextFormat = Toolkit.getProperty("AWT.InputMethodCreationFailed",
                                                     "Could not create {0}. Reason: {1}");
        Object[] args =
            {inputMethodLocator.getDescriptor().getInputMethodDisplayName(null, Locale.getDefault()),
             throwable.getLocalizedMessage()};
        MessageFormat mf = new MessageFormat(errorTextFormat);
        logger.config(mf.format(args));
    }
}
 
Example 10
Source File: InputContext.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void logCreationFailed(Throwable throwable) {
    PlatformLogger logger = PlatformLogger.getLogger("sun.awt.im");
    if (logger.isLoggable(PlatformLogger.Level.CONFIG)) {
        String errorTextFormat = Toolkit.getProperty("AWT.InputMethodCreationFailed",
                                                     "Could not create {0}. Reason: {1}");
        Object[] args =
            {inputMethodLocator.getDescriptor().getInputMethodDisplayName(null, Locale.getDefault()),
             throwable.getLocalizedMessage()};
        MessageFormat mf = new MessageFormat(errorTextFormat);
        logger.config(mf.format(args));
    }
}
 
Example 11
Source File: InputContext.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void logCreationFailed(Throwable throwable) {
    PlatformLogger logger = PlatformLogger.getLogger("sun.awt.im");
    if (logger.isLoggable(PlatformLogger.Level.CONFIG)) {
        String errorTextFormat = Toolkit.getProperty("AWT.InputMethodCreationFailed",
                                                     "Could not create {0}. Reason: {1}");
        Object[] args =
            {inputMethodLocator.getDescriptor().getInputMethodDisplayName(null, Locale.getDefault()),
             throwable.getLocalizedMessage()};
        MessageFormat mf = new MessageFormat(errorTextFormat);
        logger.config(mf.format(args));
    }
}
 
Example 12
Source File: WInputMethodDescriptor.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodDisplayName
 */
@Override
public synchronized String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) {
    // We ignore the input locale.
    // When displaying for the default locale, rely on the localized AWT properties;
    // for any other locale, fall back to English.
    String name = "System Input Methods";
    if (Locale.getDefault().equals(displayLanguage)) {
        name = Toolkit.getProperty("AWT.HostInputMethodDisplayName", name);
    }
    return name;
}
 
Example 13
Source File: WInputMethodDescriptor.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodDisplayName
 */
@Override
public synchronized String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) {
    // We ignore the input locale.
    // When displaying for the default locale, rely on the localized AWT properties;
    // for any other locale, fall back to English.
    String name = "System Input Methods";
    if (Locale.getDefault().equals(displayLanguage)) {
        name = Toolkit.getProperty("AWT.HostInputMethodDisplayName", name);
    }
    return name;
}
 
Example 14
Source File: InputContext.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private void logCreationFailed(Throwable throwable) {
    PlatformLogger logger = PlatformLogger.getLogger("sun.awt.im");
    if (logger.isLoggable(PlatformLogger.Level.CONFIG)) {
        String errorTextFormat = Toolkit.getProperty("AWT.InputMethodCreationFailed",
                                                     "Could not create {0}. Reason: {1}");
        Object[] args =
            {inputMethodLocator.getDescriptor().getInputMethodDisplayName(null, Locale.getDefault()),
             throwable.getLocalizedMessage()};
        MessageFormat mf = new MessageFormat(errorTextFormat);
        logger.config(mf.format(args));
    }
}
 
Example 15
Source File: WInputMethodDescriptor.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodDisplayName
 */
@Override
public synchronized String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) {
    // We ignore the input locale.
    // When displaying for the default locale, rely on the localized AWT properties;
    // for any other locale, fall back to English.
    String name = "System Input Methods";
    if (Locale.getDefault().equals(displayLanguage)) {
        name = Toolkit.getProperty("AWT.HostInputMethodDisplayName", name);
    }
    return name;
}
 
Example 16
Source File: WInputMethodDescriptor.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see java.awt.im.spi.InputMethodDescriptor#getInputMethodDisplayName
 */
@Override
public synchronized String getInputMethodDisplayName(Locale inputLocale, Locale displayLanguage) {
    // We ignore the input locale.
    // When displaying for the default locale, rely on the localized AWT properties;
    // for any other locale, fall back to English.
    String name = "System Input Methods";
    if (Locale.getDefault().equals(displayLanguage)) {
        name = Toolkit.getProperty("AWT.HostInputMethodDisplayName", name);
    }
    return name;
}
 
Example 17
Source File: InputMethodPopupMenu.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a localized locale name for input methods with the
 * given locale. It falls back to Locale.getDisplayName() and
 * then to Locale.toString() if no localized locale name is found.
 *
 * @param locale Locale for which localized locale name is obtained
 */
String getLocaleName(Locale locale) {
    String localeString = locale.toString();
    String localeName = Toolkit.getProperty("AWT.InputMethodLanguage." + localeString, null);
    if (localeName == null) {
        localeName = locale.getDisplayName();
        if (localeName == null || localeName.length() == 0)
            localeName = localeString;
    }
    return localeName;
}
 
Example 18
Source File: CompositionArea.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
CompositionArea() {
    // create composition window with localized title
    String windowTitle = Toolkit.getProperty("AWT.CompositionWindowTitle", "Input Window");
    compositionWindow =
        (JFrame)InputMethodContext.createInputMethodWindow(windowTitle, null, true);

    setOpaque(true);
    setBorder(LineBorder.createGrayLineBorder());
    setForeground(Color.black);
    setBackground(Color.white);

    // if we get the focus, we still want to let the client's
    // input context handle the event
    enableInputMethods(true);
    enableEvents(AWTEvent.KEY_EVENT_MASK);

    compositionWindow.getContentPane().add(this);
    compositionWindow.addWindowListener(new FrameWindowAdapter());
    addInputMethodListener(this);
    compositionWindow.enableInputMethods(false);
    compositionWindow.pack();
    Dimension windowSize = compositionWindow.getSize();
    Dimension screenSize = (getToolkit()).getScreenSize();
    compositionWindow.setLocation(screenSize.width - windowSize.width-20,
                                screenSize.height - windowSize.height-100);
    compositionWindow.setVisible(false);
}
 
Example 19
Source File: ExecutableInputMethodManager.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
synchronized void initialize() {
    selectInputMethodMenuTitle = Toolkit.getProperty("AWT.InputMethodSelectionMenu", "Select Input Method");

    triggerMenuString = selectInputMethodMenuTitle;
}
 
Example 20
Source File: ExecutableInputMethodManager.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
synchronized void initialize() {
    selectInputMethodMenuTitle = Toolkit.getProperty("AWT.InputMethodSelectionMenu", "Select Input Method");

    triggerMenuString = selectInputMethodMenuTitle;
}