當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。