本文整理汇总了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");
}
示例2: initialize
import java.awt.Toolkit; //导入方法依赖的package包/类
synchronized void initialize() {
selectInputMethodMenuTitle = Toolkit.getProperty("AWT.InputMethodSelectionMenu", "Select Input Method");
triggerMenuString = selectInputMethodMenuTitle;
}
示例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);
}
示例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));
}
}
示例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;
}
示例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;
}
示例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;
}