12-14-2009 08:57 PM
Hi guys,
I want to display rows like this:
I want to achive this!
I am going to sleep!
That means i must set font for each element but dynamically way. (i already have the sign (like tags in html) to know what element must be set font).
Note: 'cause i have an big amount of data then i can not hard code for single row.
Plz let's me know your ideas ~ many thanks.
12-15-2009 01:27 AM
You can achieve this using RichTextField.
Have a look at this KB article.
Regards
Bikas
12-15-2009 01:56 AM
Thank bikas, but I must implement that in List Field
12-15-2009 02:21 AM
this can be done by implementing the drawListRow() in ListFieldCallBack
public void drawListRow (ListField lstField, Graphics g, int index, int y, int width)
{
int xpos;
xpos = g.drawText (msg[0], 0, y);
g.setFont (Font.getDefault().derive(Font.BOLD));
xpos = g.drawText (msg[1], xpos+2, y);
g.setFont (Font.getDefault().derive(Font.ITALIC));
xpos = g.drawText (msg[2], xpos+2, y);
}
12-15-2009 07:52 AM
thank zany but i think it's still hard code
12-15-2009 07:58 AM
Ya, you have hard code the font and list data. May be you can maitain a map between font and list data to avoid hard coding the data if it is possible
.
12-15-2009 08:12 AM
you could put an own markup string into the object and parse it in the listfields draw callback.
or describe the format of the string in additional attributes, similar to css.