本文整理匯總了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;
}