本文整理匯總了Java中java.awt.Font.DIALOG_INPUT屬性的典型用法代碼示例。如果您正苦於以下問題:Java Font.DIALOG_INPUT屬性的具體用法?Java Font.DIALOG_INPUT怎麽用?Java Font.DIALOG_INPUT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類java.awt.Font
的用法示例。
在下文中一共展示了Font.DIALOG_INPUT屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getInstalledFontFamilyNames
/**
* Get a list of installed fonts in the requested {@link Locale}.
* The list contains the fonts Family Names.
* If Locale is null, the default locale is used.
*
* @param requestedLocale, if null the default locale is used.
* @return list of installed fonts in the system.
*/
public String[] getInstalledFontFamilyNames(Locale requestedLocale) {
if (requestedLocale == null) {
requestedLocale = Locale.getDefault();
}
if (allFamilies != null && lastDefaultLocale != null &&
requestedLocale.equals(lastDefaultLocale)) {
String[] copyFamilies = new String[allFamilies.length];
System.arraycopy(allFamilies, 0, copyFamilies,
0, allFamilies.length);
return copyFamilies;
}
TreeMap<String,String> familyNames = new TreeMap<String,String>();
// these names are always there and aren't localised
String str;
str = Font.SERIF; familyNames.put(str.toLowerCase(), str);
str = Font.SANS_SERIF; familyNames.put(str.toLowerCase(), str);
str = Font.MONOSPACED; familyNames.put(str.toLowerCase(), str);
str = Font.DIALOG; familyNames.put(str.toLowerCase(), str);
str = Font.DIALOG_INPUT; familyNames.put(str.toLowerCase(), str);
/* Platform APIs may be used to get the set of available family
* names for the current default locale so long as it is the same
* as the start-up system locale, rather than loading all fonts.
*/
if (requestedLocale.equals(getSystemStartupLocale()) &&
getFamilyNamesFromPlatform(familyNames, requestedLocale)) {
/* Augment platform names with JRE font family names */
getJREFontFamilyNames(familyNames, requestedLocale);
} else {
loadFontFiles();
Font2D[] physicalfonts = getPhysicalFonts();
for (int i=0; i < physicalfonts.length; i++) {
if (!(physicalfonts[i] instanceof NativeFont)) {
String name =
physicalfonts[i].getFamilyName(requestedLocale);
familyNames.put(name.toLowerCase(requestedLocale), name);
}
}
}
// Add any native font family names here
addNativeFontFamilyNames(familyNames, requestedLocale);
String[] retval = new String[familyNames.size()];
Object [] keyNames = familyNames.keySet().toArray();
for (int i=0; i < keyNames.length; i++) {
retval[i] = (String)familyNames.get(keyNames[i]);
}
if (requestedLocale.equals(Locale.getDefault())) {
lastDefaultLocale = requestedLocale;
allFamilies = new String[retval.length];
System.arraycopy(retval, 0, allFamilies, 0, allFamilies.length);
}
return retval;
}
示例2: getInstalledFontFamilyNames
/**
* Get a list of installed fonts in the requested {@link Locale}.
* The list contains the fonts Family Names.
* If Locale is null, the default locale is used.
*
* @param requestedLocale, if null the default locale is used.
* @return list of installed fonts in the system.
*/
public String[] getInstalledFontFamilyNames(Locale requestedLocale) {
if (requestedLocale == null) {
requestedLocale = Locale.getDefault();
}
if (allFamilies != null && lastDefaultLocale != null &&
requestedLocale.equals(lastDefaultLocale)) {
String[] copyFamilies = new String[allFamilies.length];
System.arraycopy(allFamilies, 0, copyFamilies,
0, allFamilies.length);
return copyFamilies;
}
TreeMap<String,String> familyNames = new TreeMap<String,String>();
// these names are always there and aren't localised
String str;
str = Font.SERIF; familyNames.put(str.toLowerCase(), str);
str = Font.SANS_SERIF; familyNames.put(str.toLowerCase(), str);
str = Font.MONOSPACED; familyNames.put(str.toLowerCase(), str);
str = Font.DIALOG; familyNames.put(str.toLowerCase(), str);
str = Font.DIALOG_INPUT; familyNames.put(str.toLowerCase(), str);
/* Platform APIs may be used to get the set of available family
* names for the current default locale so long as it is the same
* as the start-up system locale, rather than loading all fonts.
*/
if (requestedLocale.equals(getSystemStartupLocale()) &&
getFamilyNamesFromPlatform(familyNames, requestedLocale)) {
/* Augment platform names with JRE font family names */
getJREFontFamilyNames(familyNames, requestedLocale);
} else {
loadFontFiles();
Font2D[] physicalfonts = getPhysicalFonts();
for (int i=0; i < physicalfonts.length; i++) {
if (!(physicalfonts[i] instanceof NativeFont)) {
String name =
physicalfonts[i].getFamilyName(requestedLocale);
familyNames.put(name.toLowerCase(requestedLocale), name);
}
}
}
// Add any native font family names here
addNativeFontFamilyNames(familyNames, requestedLocale);
String[] retval = new String[familyNames.size()];
Object [] keyNames = familyNames.keySet().toArray();
for (int i=0; i < keyNames.length; i++) {
retval[i] = familyNames.get(keyNames[i]);
}
if (requestedLocale.equals(Locale.getDefault())) {
lastDefaultLocale = requestedLocale;
allFamilies = new String[retval.length];
System.arraycopy(retval, 0, allFamilies, 0, allFamilies.length);
}
return retval;
}