BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-13-2010, 09:44 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Mar 2010
Model: 7100T
PIN: N/A
Carrier: job
Posts: 15
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default word wrap

Please Login to Remove!

i implement list field but i have long text field how to make word wrap format in paint methode .
my code here

import java.util.Vector;
import net.rim.device.api.system.Display;
import net.rim.device.api.ui.Graphics;
import net.rim.device.api.ui.component.ListField;
import net.rim.device.api.ui.component.ListFieldCallback;
import net.rim.device.api.system.Bitmap;
import net.rim.device.api.ui.Font;
import net.rim.device.api.ui.Color;
import net.rim.device.api.ui.DrawStyle;
class ListCallBack implements ListFieldCallback
{
private Vector listElements = new Vector();
private Vector listElements1 = new Vector();
private Vector listElements2 = new Vector();
private Vector listImg = new Vector();
int width,height;


public void drawListRow(ListField list, Graphics g, int index, int y, int w)
{
String Name = (String)listElements.elementAt(index);
String dateofbirth = (String)listElements1.elementAt(index);
String status = (String)listElements2.elementAt(index);


Bitmap image=(Bitmap)listImg.elementAt(index);
height=image.getHeight()+5;
width=Display.getWidth();

//g.drawRect(0,0,width,20);
int imgwidsize=image.getWidth();
int textwid=(imgwidsize)+10;
g.setFont(g.getFont().derive(Font.PLAIN,14));
int fonthight=g.getFont().getHeight();
int z=y+5;
int fhight=z+fonthight;
int totalwidth=width-imgwidsize;
// System.out.println("width="+totalwidth+"textwid"+N ame.length()) ;


g.drawBitmap(0,z,image.getWidth(),image.getHeight( ),image,0,0);
g.drawText("Name : "+Name,textwid,z,DrawStyle.LEADING | DrawStyle.ELLIPSIS, w-textwid);
g.drawText("Dob : "+dateofbirth,textwid,fhight,DrawStyle.LEADING | DrawStyle.ELLIPSIS, w-textwid);
g.drawText("Status : "+status,textwid,fonthight+fhight,DrawStyle.LEADIN G | DrawStyle.ELLIPSIS, w-textwid);
g.setColor(Color.BLACK);
g.drawRect(0,y+1,width,1);
}
public Object get(ListField list, int index)
{
return listImg.elementAt(index);
}

public int getPreferredWidth(ListField list)
{
return Display.getWidth();
}

public void insert(String toInsert ,int index)
{
listElements.insertElementAt(toInsert,index);
}

public void insert1(String toInsert ,int index)
{
listElements1.insertElementAt(toInsert,index);
}
public void insert2(String toInsert ,int index)
{
listElements2.insertElementAt(toInsert,index);
}

public void insertimg(Bitmap toInsertmap ,int index)
{
listImg.insertElementAt(toInsertmap,index);
}

public void erase()
{
//listElements.removeAllElements();
}

public int indexOfList(ListField listField, String prefix, int start) {
return listImg.indexOf(listField);

}
public int size() {
return listImg.size();
}



}


please help code via.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

VINTAGE CLAROSTAT POTENTIOMETER 191031-B MADE IN BROOKLYN NY USA, ANTIQUE
$12.99
VINTAGE CLAROSTAT POTENTIOMETER 191031-B MADE IN BROOKLYN NY USA, ANTIQUE pictureVINTAGE CLAROSTAT POTENTIOMETER 191031-B BROOKLYN NY USA, RARE
$9.99
VINTAGE CLAROSTAT POTENTIOMETER 191031-B BROOKLYN NY USA, RARE pictureH1 10 Pcs Potentiometer Trimmer Variable Resistor 3362P-103 10K Ohm J5O8
$1.28
H1 10 Pcs Potentiometer Trimmer Variable Resistor 3362P-103 10K Ohm J5O8 picture10x Insert Tone Core Brass Control Knobs For 4mm Dia Knurled Potentiometer-Shaft
$1.99
10x Insert Tone Core Brass Control Knobs For 4mm Dia Knurled Potentiometer-Shaft picture*sanscan8* Lot of 6 Vintage-Daven-Attenuator-Potentiometer
$240.0
*sanscan8* Lot of 6 Vintage-Daven-Attenuator-Potentiometer picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.