本文整理汇总了Java中javax.microedition.lcdui.Font.getDefaultFont方法的典型用法代码示例。如果您正苦于以下问题:Java Font.getDefaultFont方法的具体用法?Java Font.getDefaultFont怎么用?Java Font.getDefaultFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.microedition.lcdui.Font
的用法示例。
在下文中一共展示了Font.getDefaultFont方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initContent
import javax.microedition.lcdui.Font; //导入方法依赖的package包/类
/**
* Initialize the graphic elements needed for this item.
*/
protected void initContent(int firstLineWidth, int availWidth, int availHeight){
if (this.font == null)
{
this.font = Font.getDefaultFont();
this.fontColor = 0x000000;
}
contentHeight = font.getHeight() + this.linePadding;
contentWidth = availWidth;
}
示例2: getPrefContentHeight
import javax.microedition.lcdui.Font; //导入方法依赖的package包/类
public int getPrefContentHeight(int h)
{
Font f = Font.getDefaultFont();
return 8 * f.getHeight() + 6;
}
示例3: drawDateBox
import javax.microedition.lcdui.Font; //导入方法依赖的package包/类
private void drawDateBox(int xPos, int yPos)
{
int prevColor = gObj.getColor();
Font font = Font.getDefaultFont();
int boxWidth = font.stringWidth("30") + 5;
int boxHeight = font.getHeight() - 2;
String monthStr = (new Integer(currMonth+1)).toString() + " ";
String dayStr = (new Integer(currDay)).toString() + " ";
String yearStr = (new Integer(currYear)).toString();
//Clear the previous rectangle on the date field
if(prevSelectionMode != -1)
{
gObj.setColor(0x00FFFFFF);
if(prevSelectionMode == MONTH)
{
boxWidth = font.stringWidth(monthStr);
gObj.fillRect(xPos, yPos, boxWidth, boxHeight);
}
else if(prevSelectionMode == DAY)
{
boxWidth = font.stringWidth(dayStr);
gObj.fillRect(xPos + font.stringWidth(monthStr), yPos, boxWidth, boxHeight);
}
else if(prevSelectionMode == YEAR)
{
boxWidth = font.stringWidth(yearStr);
gObj.fillRect(xPos + font.stringWidth(monthStr) + font.stringWidth(dayStr), yPos, boxWidth, boxHeight);
}
else if(prevSelectionMode == NONE)
{
boxWidth = font.stringWidth(NO_DATE_STR) + 5;
gObj.fillRect(xPos + font.stringWidth(monthStr) + font.stringWidth(dayStr) + font.stringWidth(yearStr) + font.stringWidth(" "), yPos, boxWidth, boxHeight);
}
}
gObj.setColor(0x0000FF0A);
if(selectionMode == MONTH)
{
boxWidth = font.stringWidth(monthStr);
gObj.fillRect(xPos, yPos, boxWidth, boxHeight);
}
else if(selectionMode == DAY)
{
boxWidth = font.stringWidth(dayStr);
gObj.fillRect(xPos + font.stringWidth(monthStr), yPos, boxWidth, boxHeight);
}
else if(selectionMode == YEAR)
{
boxWidth = font.stringWidth(yearStr);
gObj.fillRect(xPos + font.stringWidth(monthStr) + font.stringWidth(dayStr), yPos, boxWidth, boxHeight);
}
else if(selectionMode == NONE)
{
boxWidth = font.stringWidth(NO_DATE_STR);
gObj.fillRect(xPos + font.stringWidth(monthStr) + font.stringWidth(dayStr) + font.stringWidth(yearStr) + font.stringWidth(" ") , yPos, boxWidth, boxHeight);
}
gObj.setColor(prevColor);
}
示例4: getPrefContentHeight
import javax.microedition.lcdui.Font; //导入方法依赖的package包/类
public int getPrefContentHeight(int h) { Font f = Font.getDefaultFont(); return 8 * f.getHeight() + 6; }