www.pudn.com > j2me_Mario.rar > LPFormatCHNString.java
/** *Title: lipeng
*Description: * You cannot remove this copyright and notice. * You cannot use this file without the express permission of the author. * All Rights Reserved
*Copyright: lizhenpeng (c) 2004
*Company: LP&P
* @author lizhenpeng * @version 1.0.0 ** Revise History *
*/ package lipeng; import javax.microedition.lcdui.*; public class LPFormatCHNString { public LPFormatCHNString(String str,int width,int height,Font font) { helpStr=str; strLen = str.length(); beginLine=0; this.font=font; String benchStr="Ετ"; char[] bufferStr=benchStr.toCharArray(); int charWidth=font.charsWidth(bufferStr,0,bufferStr.length); lineStrLen=width/charWidth; strHeightNum=height/font.getHeight(); endLine=strHeightNum; maxLine = strLen/lineStrLen + (strLen%lineStrLen==0? 0:1); } public void paint(Graphics g) { int i; for(i=beginLine;i