How to develop custom List Field in Blackberry?

You should draw rectangle in listfield row which is selected.. some thing like this. Here I have done it for on focus.

You should draw rectangle in listfield row which is selected.. some thing like this. Here I have done it for on focus.. public void drawListRow(ListField list, Graphics g, int index, int y,int w) { if (g. IsDrawingStyleSet(Graphics.

DRAWSTYLE_FOCUS)) { g. SetBackgroundColor(0x00572000); //g. SetBackgroundColor(); g.clear(); //g.

SetColor(Color. BLACK); // g. FillRect(0,list.getWidth(),list.getWidth(),80); g.

SetColor(Color. ORANGE); g. FillRect(94,y+0,400,30); //g.

SetColor(0x000000); g. SetColor(Color. WHITE); g.

DrawText(text, 95, y+10, (DrawStyle. LEFT ), w ); } else { g. SetColor(0x00906966); g.

FillRect(94,y+0,400,30); g. SetColor(Color. ORANGE); g.

DrawText(text, 95, y+10, (DrawStyle. LEFT ), w ); }}.

Thank you for your answer. I tested your code. It shows orange color when a list item gain focus.

If I click on that item is it possible to fix the orange color for the item which I am clicked – Ajay Aug 29 at 10:53.

Try this ... private class MyListField extends ListField{ //0,ListField. MULTI_SELECT private boolean hasFocus = false; public void onFocus(int direction){ hasFocus = true; } public void onUnfocus() { hasFocus = false; super.onUnfocus(); invalidate(); } public void paint(Graphics graphics) { int width = Display.getWidth(); //Get the current clipping region XYRect redrawRect = graphics.getClippingRect(); if(redrawRect. Y "); } //Determine the start location of the clipping region and end.Int rowHeight = getRowHeight(); int curSelected; //If the ListeField has focus determine the selected row.

If (hasFocus) { curSelected = getSelectedIndex(); } else { curSelected = -1; } int startLine = redrawRect. Y / rowHeight; int endLine = (redrawRect. Y + redrawRect.

Height - 1) / rowHeight; endLine = Math. Min(endLine, getSize() - 1); int y = startLine * rowHeight; //Setup the data used for drawing.Int yInds = new int{y, y, y + rowHeight, y + rowHeight}; int xInds = new int{0, width, width, 0}; //Set the callback - assuming String values. ListFieldCallback callBack = this.getCallback(); //Draw each row for(; startLine SetColor(Color.

LIGHTYELLOW); graphics. DrawFilledPath(xInds, yInds, null, null); graphics. SetColor(Color.

BLACK); graphics. DrawText((String)callBack. Get(this, startLine), 0, yInds0); } else{ //Draw the odd or selected rows.

Graphics. SetColor(Color. LIGHTGREY); graphics.

DrawText((String)callBack. Get(this, startLine), 0, yInds0); } //Assign new values to the y axis moving one row down. Y += rowHeight; yInds0 = y; yInds1 = yInds0; yInds2 = y + rowHeight; yInds3 = yInds2; } //super.

Paint(graphics); } } .. . Refer this LINK : http://berrytutorials.blogspot.com/2009/11/create-custom-listfield-change.html.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions