(keitai-l) Re: wrapping and scrolling using java ??

From: Henry Minsky <hqm_at_ai.mit.edu>
Date: 03/13/01
Message-Id: <5.0.2.1.2.20010313211653.0243adb0@pop.ai.mit.edu>
The example code was on pp 43 of the API guide 
http://www.nttdocomo.co.jp/i/java/pdf/jguide_api001212.pdf

(sorry about the formatting, I cut and paste this from Adobe Acrobat)

public void drawText(Graphics g,y,int width){
int len =str.length();
char data[ ] =new char[ len] ;
str.getChars(0,len,data,0);
int startIdx =0;
int endIdx =0;
int h =f.getHeight();
while (len >0){
endIdx =f.getLineBreak(str,startIdx,len,width);
g.drawChar(data,off,endIdx -startIdx,x,y);
len -=(endIdx -statIdx);
startIdx =endIdx;
y +=h;
}


f refers to a Font object, which you need to ask how big a given character is.
For a font with fixed width, you know the width of a string, otherwise 
you'll need to ask each the font the string length. In theory this would 
involve the Font.stringLength() method
although it doesn't seem to be documented in the API doc for some reason. I 
haven't
gotten my hands on a real developer kit yet, so I don't know what the range 
of actual
fonts supported by current hardware is.




java.lang.ObjectAt 02:21 AM 3/13/01 +0000, you wrote:
>Hi,
>
>Does anyone know of a cool way to wrap text on the imode phones using 
>iappli's. Displaying it either as a label or using the drawstring doesn't 
>wrap the text for me. Am i missing something or it's just not supported.
>
>Also is there a way to scroll up and down on screen without actually 
>having to jump from component to component.
>
>Any help on these 2 issues would be really appreciated.
>
>Thanks,
>-Ashish
>_________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
>[ Did you check the archives?   http://www.appelsiini.net/keitai-l/ ]
>


[ Did you check the archives?   http://www.appelsiini.net/keitai-l/ ]
Received on Tue Mar 13 14:18:05 2001