本文整理汇总了Java中javax.microedition.lcdui.Font.STYLE_BOLD属性的典型用法代码示例。如果您正苦于以下问题:Java Font.STYLE_BOLD属性的具体用法?Java Font.STYLE_BOLD怎么用?Java Font.STYLE_BOLD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.microedition.lcdui.Font
的用法示例。
在下文中一共展示了Font.STYLE_BOLD属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFont
private static Font getFont(String face, String style, String size) {
int meFace = 0;
if (face.equalsIgnoreCase("system")) {
meFace |= Font.FACE_SYSTEM;
} else if (face.equalsIgnoreCase("monospace")) {
meFace |= Font.FACE_MONOSPACE;
} else if (face.equalsIgnoreCase("proportional")) {
meFace |= Font.FACE_PROPORTIONAL;
}
int meStyle = 0;
String testStyle = style.toLowerCase();
if (testStyle.indexOf("plain") != -1) {
meStyle |= Font.STYLE_PLAIN;
}
if (testStyle.indexOf("bold") != -1) {
meStyle |= Font.STYLE_BOLD;
}
if (testStyle.indexOf("italic") != -1) {
meStyle |= Font.STYLE_ITALIC;
}
if (testStyle.indexOf("underlined") != -1) {
meStyle |= Font.STYLE_UNDERLINED;
}
int meSize = 0;
if (size.equalsIgnoreCase("small")) {
meSize |= Font.SIZE_SMALL;
} else if (size.equalsIgnoreCase("medium")) {
meSize |= Font.SIZE_MEDIUM;
} else if (size.equalsIgnoreCase("large")) {
meSize |= Font.SIZE_LARGE;
}
return Font.getFont(meFace, meStyle, meSize);
}
示例2: setFont
public void setFont(String face, String style, String size, org.microemu.device.impl.Font font) {
int key = 0;
if (face.equalsIgnoreCase("system")) {
key |= Font.FACE_SYSTEM;
} else if (face.equalsIgnoreCase("monospace")) {
key |= Font.FACE_MONOSPACE;
} else if (face.equalsIgnoreCase("proportional")) {
key |= Font.FACE_PROPORTIONAL;
}
String testStyle = style.toLowerCase();
if (testStyle.indexOf("plain") != -1) {
key |= Font.STYLE_PLAIN;
}
if (testStyle.indexOf("bold") != -1) {
key |= Font.STYLE_BOLD;
}
if (testStyle.indexOf("italic") != -1) {
key |= Font.STYLE_ITALIC;
}
if (testStyle.indexOf("underlined") != -1) {
key |= Font.STYLE_UNDERLINED;
}
if (size.equalsIgnoreCase("small")) {
key |= Font.SIZE_SMALL;
} else if (size.equalsIgnoreCase("medium")) {
key |= Font.SIZE_MEDIUM;
} else if (size.equalsIgnoreCase("large")) {
key |= Font.SIZE_LARGE;
}
fonts.put(new Integer(key), font);
}
示例3: getFont
static AndroidFont getFont(Font meFont)
{
AndroidFont result = fonts.get(meFont);
if (result == null) {
Typeface family = Typeface.SANS_SERIF;
if (meFont.getFace() == Font.FACE_SYSTEM) {
family = Typeface.SANS_SERIF;
} else if (meFont.getFace() == Font.FACE_MONOSPACE) {
family = Typeface.MONOSPACE;
} else if (meFont.getFace() == Font.FACE_PROPORTIONAL) {
family = Typeface.SANS_SERIF;
}
int style = 0;
if ((meFont.getStyle() & Font.STYLE_PLAIN) != 0) {
style |= Typeface.NORMAL;
}
if ((meFont.getStyle() & Font.STYLE_BOLD) != 0) {
style |= Typeface.BOLD;
}
if ((meFont.getStyle() & Font.STYLE_ITALIC) != 0) {
style |= Typeface.ITALIC;
}
boolean underlined = false;
if ((meFont.getStyle() & Font.STYLE_UNDERLINED) != 0) {
underlined = true;
}
int size = 0;
if (meFont.getSize() == Font.SIZE_SMALL) {
size = MicroEmulatorActivity.config.FONT_SIZE_SMALL;
} else if (meFont.getSize() == Font.SIZE_MEDIUM) {
size = MicroEmulatorActivity.config.FONT_SIZE_MEDIUM;
} else if (meFont.getSize() == Font.SIZE_LARGE) {
size = MicroEmulatorActivity.config.FONT_SIZE_LARGE;
}
result = new AndroidFont(Typeface.create(family, style), TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_SP,
size,
metrics), underlined);
fonts.put(meFont, result);
}
return result;
}
示例4: getFont
org.microemu.device.impl.Font getFont(Font meFont) {
int key = 0;
key |= meFont.getFace();
key |= meFont.getStyle();
key |= meFont.getSize();
org.microemu.device.impl.Font result = (org.microemu.device.impl.Font) fonts.get(new Integer(key));
if (result == null) {
String name = null;
if (meFont.getFace() == Font.FACE_SYSTEM) {
name = FACE_SYSTEM_NAME;
} else if (meFont.getFace() == Font.FACE_MONOSPACE) {
name = FACE_MONOSPACE_NAME;
} else if (meFont.getFace() == Font.FACE_PROPORTIONAL) {
name = FACE_PROPORTIONAL_NAME;
}
String style = ",";
if ((meFont.getStyle() & Font.STYLE_PLAIN) != 0) {
style += "plain,";
}
if ((meFont.getStyle() & Font.STYLE_BOLD) != 0) {
style += "bold,";
}
if ((meFont.getStyle() & Font.STYLE_ITALIC) != 0) {
style += "italic,";
}
if ((meFont.getStyle() & Font.STYLE_ITALIC) != 0) {
style += "underlined,";
}
style = style.substring(0, style.length() - 1);
int size = 0;
if (meFont.getSize() == Font.SIZE_SMALL) {
size = SIZE_SMALL;
} else if (meFont.getSize() == Font.SIZE_MEDIUM) {
size = SIZE_MEDIUM;
} else if (meFont.getSize() == Font.SIZE_LARGE) {
size = SIZE_LARGE;
}
result = new SwtSystemFont(name, style, size, antialiasing);
fonts.put(new Integer(key), result);
}
return result;
}
示例5: getFont
org.microemu.device.impl.Font getFont(Font meFont)
{
int key = 0;
key |= meFont.getFace();
key |= meFont.getStyle();
key |= meFont.getSize();
org.microemu.device.impl.Font result = (org.microemu.device.impl.Font) fonts.get(new Integer(key));
if (result == null) {
String name = null;
if (meFont.getFace() == Font.FACE_SYSTEM) {
name = FACE_SYSTEM_NAME;
} else if (meFont.getFace() == Font.FACE_MONOSPACE) {
name = FACE_MONOSPACE_NAME;
} else if (meFont.getFace() == Font.FACE_PROPORTIONAL) {
name = FACE_PROPORTIONAL_NAME;
}
String style = ",";
if ((meFont.getStyle() & Font.STYLE_PLAIN) != 0) {
style += "plain,";
}
if ((meFont.getStyle() & Font.STYLE_BOLD) != 0) {
style += "bold,";
}
if ((meFont.getStyle() & Font.STYLE_ITALIC) != 0) {
style += "italic,";
}
if ((meFont.getStyle() & Font.STYLE_ITALIC) != 0) {
style += "underlined,";
}
style = style.substring(0, style.length() - 1);
int size = 0;
if (meFont.getSize() == Font.SIZE_SMALL) {
size = SIZE_SMALL;
} else if (meFont.getSize() == Font.SIZE_MEDIUM) {
size = SIZE_MEDIUM;
} else if (meFont.getSize() == Font.SIZE_LARGE) {
size = SIZE_LARGE;
}
result = new J2SESystemFont(name, style, size, antialiasing);
fonts.put(new Integer(key), result);
}
return result;
}
示例6: getFont
static AndroidFont getFont(Font meFont)
{
AndroidFont result = fonts.get(meFont);
if (result == null) {
Typeface family = Typeface.SANS_SERIF;
if (meFont.getFace() == Font.FACE_SYSTEM) {
family = Typeface.SANS_SERIF;
} else if (meFont.getFace() == Font.FACE_MONOSPACE) {
family = Typeface.MONOSPACE;
} else if (meFont.getFace() == Font.FACE_PROPORTIONAL) {
family = Typeface.SANS_SERIF;
}
int style = 0;
if ((meFont.getStyle() & Font.STYLE_PLAIN) != 0) {
style |= Typeface.NORMAL;
}
if ((meFont.getStyle() & Font.STYLE_BOLD) != 0) {
style |= Typeface.BOLD;
}
if ((meFont.getStyle() & Font.STYLE_ITALIC) != 0) {
style |= Typeface.ITALIC;
}
boolean underlined = false;
if ((meFont.getStyle() & Font.STYLE_UNDERLINED) != 0) {
underlined = true;
}
int size = 0;
if (meFont.getSize() == Font.SIZE_SMALL) {
size = MicroEmulatorActivity.config.FONT_SIZE_SMALL;
} else if (meFont.getSize() == Font.SIZE_MEDIUM) {
size = MicroEmulatorActivity.config.FONT_SIZE_MEDIUM;
} else if (meFont.getSize() == Font.SIZE_LARGE) {
size = MicroEmulatorActivity.config.FONT_SIZE_LARGE;
}
// Once default font size is defined,
// compute size relative to scaleDensity
// to enable consistent font size ratio
// accross any device resolution/density
//size *= metrics.scaledDensity;
result = new AndroidFont(Typeface.create(family, style), size, underlined);
fonts.put(meFont, result);
}
return result;
}