当前位置: 首页>>代码示例>>Java>>正文


Java Toolkit.getProperty方法代码示例

本文整理汇总了Java中java.awt.Toolkit.getProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Toolkit.getProperty方法的具体用法?Java Toolkit.getProperty怎么用?Java Toolkit.getProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Toolkit的用法示例。


在下文中一共展示了Toolkit.getProperty方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import java.awt.Toolkit; //导入方法依赖的package包/类
public static void main(String args[]) {
    Locale locale = Locale.getDefault();
    try {
        Locale.setDefault(ru_RU);
        // Get the value for the test key "foo"
        String value = Toolkit.getProperty("foo", "undefined");
        if (!value.equals("bar")) {
            throw new RuntimeException("key = foo, value = " + value);
        }
        // Get the value for a valid key "AWT.enter"
        value = Toolkit.getProperty("AWT.enter", "DO NOT ENTER");
        if (value.equals("DO NOT ENTER")) {
            throw new RuntimeException("AWT.enter undefined.");
        }
    } finally {
        // Restore the default Locale
        Locale.setDefault(locale);
    }
    System.out.println("Bug6299235Test passed");
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:Bug6299235Test.java

示例2: initialize

import java.awt.Toolkit; //导入方法依赖的package包/类
synchronized void initialize() {
    selectInputMethodMenuTitle = Toolkit.getProperty("AWT.InputMethodSelectionMenu", "Select Input Method");

    triggerMenuString = selectInputMethodMenuTitle;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:6,代码来源:ExecutableInputMethodManager.java

示例3: CompositionArea

import java.awt.Toolkit; //导入方法依赖的package包/类
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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:CompositionArea.java

示例4: logCreationFailed

import java.awt.Toolkit; //导入方法依赖的package包/类
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));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:InputContext.java

示例5: getLocaleName

import java.awt.Toolkit; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:InputMethodPopupMenu.java

示例6: getInputMethodDisplayName

import java.awt.Toolkit; //导入方法依赖的package包/类
/**
 * @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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:WInputMethodDescriptor.java

示例7: getInputMethodDisplayName

import java.awt.Toolkit; //导入方法依赖的package包/类
/**
 * @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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:14,代码来源:X11InputMethodDescriptor.java


注:本文中的java.awt.Toolkit.getProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。