09-30-2008 05:33 AM
I have created the List with checkField using the sample code . But I have to increase the spacing in between consecutive rows. How to do that ? here is my code snippet
public void drawListRow(ListField list, Graphics g, int index, int y, int w) { //Get the ChecklistData for the current row. ChecklistData currentRow = (ChecklistData) listElements.elementAt(index); String text = currentRow.getStringVal(); if (currentRow.isChecked()) { g.drawBitmap(0, y, checkedImage.getWidth(), checkedImage.getHeight(), checkedImage, 0, 0); g.setColor(Color.WHITE); g.drawText(text, checkedImage.getWidth() + 10, y, 0, w); } else { g.drawBitmap(0, y, uncheckedImage.getWidth(), uncheckedImage.getHeight(), uncheckedImage, 0, 0); g.setColor(Color.WHITE); g.drawText(text, checkedImage.getWidth() + 10, y, 0, w); } }
Thanks in advance.
Solved! Go to Solution.
09-30-2008 06:33 AM
Presume you mean ListField in your subject?
setRowHeight()
For example, to allow for a 3 pixel spacing:
myListfield.setRowHeight(myListfield.getFont().get
Code not tested or even compiled, but you get the idea.
09-30-2008 06:38 AM
Use y parameter in drawListRow() method.
It indicates current Y position for the current row.
09-30-2008 07:57 AM