Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Amit_K
Posts: 135
Registered: ‎08-27-2008
My Device: Not Specified
Accepted Solution

Increase the space in between consecutive Rows of ListBox

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.

Please use plain text.
Developer
peter_strange
Posts: 19,599
Registered: ‎07-14-2008
My Device: Not Specified

Re: Increase the space in between consecutive Rows of ListBox

Presume you mean ListField in your subject? 

 

setRowHeight()

 

For example, to allow for a 3 pixel spacing:

myListfield.setRowHeight(myListfield.getFont().getHeight() + 3);

 

Code not tested or even compiled, but you get the idea.

Please use plain text.
Developer
rafo
Posts: 507
Registered: ‎07-15-2008
My Device: Not Specified

Re: Increase the space in between consecutive Rows of ListBox

Use y parameter in drawListRow() method.

 

It indicates current Y position for the current row.

----------------
if your issue solved set "Solution" mark at the relevant post
Please use plain text.
Developer
Amit_K
Posts: 135
Registered: ‎08-27-2008
My Device: Not Specified

Re: Increase the space in between consecutive Rows of ListBox

Thank you very much
Please use plain text.