ListField custom

Hello

I need to make a customed ListField, who has several doubles for each element with image.

Ex) list:

1 this is the first element of the list IMAGE go HERE

Address:

Phone xxx-xxx-xxxx number

2 it's second element of the list IMAGE GO here

Address:

Phone xxx-xxx-xxxx number

3 ------

4 -----

I'll be appreciated for solutions or examples?

Thank you

DK

This works.

Thank you.

Tags: BlackBerry Developers

Similar Questions

  • Identify the index with emphasis in listfield custom

    I'm working with a custom listfield. I would like to know the index of the row that has focus, access from a menu on the screen for customization possible highlight.

    I thought it would be ListField.getSelectedIndex () but it seems that a line is selected only when you click it (or switch to selection mode).

    It doesn't seem to be a simple, API unless I'm missing something?

    Tom

    ListField.getSelectedIndex () returns the index in line with development,-1 otherwise.

    Do you have the code examples to provide?

  • Paint problem custom listfield - nullfield

    I created a listfield custom by extending the field manaagers, I use the nullfield for the effect of the update, but it does not work properly. I use two differnet layout for line manager who has no images and the other that contains images. The focus problem occurs only for lines that have pictures. I enclose the code below.

    The images appear correctly once I have the focus and remove on the line.

     //CONSTRUCTOR FOR BITMAPFIELD
        public CustomRow(String _headline, String _metadata, BitmapField bmF)
        {
            bitmapField = new BitmapField();
            bitmapField = bmF;
            _headText = new RichTextField(_headline,RichTextField.NON_FOCUSABLE);
            _metaData = new RichTextField(_metadata,RichTextField.NON_FOCUSABLE);
    
            _headText.setPadding(10, 10, 5, 10);
            _metaData.setPadding(0, 10, 10, 10);
    
            _focus = new NullField(NullField.FOCUSABLE);
            _focus.setFocusListener(this);
    
            bmpRowTextMang = new VerticalFieldManager(){
                public void sublayout(int width, int height)
                {
                    super.sublayout(Width * 3/4, height);
                    setExtent(Width * 3/4, height);
                }
            };
    
            bmpRowBmpMan = new VerticalFieldManager(){
                public void sublayout(int width, int height)
                {
                    super.sublayout(Width/4, height);
                    setExtent(Width/4, height);
                }
            };
    
            bmpRowTextMang.add(_headText);
            bmpRowTextMang.add(_metaData);
            bitmapField.setPadding(10, 10, 0, 5);
            bmpRowBmpMan.add(bitmapField);
            bmpRowMan =  new VerticalFieldManager(){
    
                public void sublayout(int width, int height)
                {
                    setPositionChild(getField(0), 0, 0);
                    layoutChild(getField(0), width, height);
    
                        setPositionChild(getField(1), 0, 0);
                    layoutChild(getField(1), width, height);
    
                    setPositionChild(getField(2),getField(1).getWidth() , 0);
                    layoutChild(getField(2), width, height);
    
                    int height1 = _headText.getHeight() + _metaData.getHeight();
    
                    if(height1<80)
                    {
                        height1 = 80;
                    }
                    setExtent(width, height1);
                }
    
                protected void paint(Graphics graphics)
                {
                    setHeightRow = this.getHeight();
                    graphics.drawLine(10, setHeightRow-1, Display.getWidth()-10, setHeightRow-1);
                    super.paint(graphics);
                }
    
                public int getPreferredHeight()
                {
                    return this.getHeight();
                }
            };
    
            bmpRowMan.add(_focus);
            bmpRowMan.add(bmpRowTextMang);
            bmpRowMan.add(bmpRowBmpMan);
            this.add(bmpRowMan);
        }
        public void focusChanged(Field field, int eventType) {
            // TODO Auto-generated method stub
            this.getManager().invalidate();
        }
        protected void paintBackground(Graphics g) {
              int prevBg = g.getBackgroundColor();
              if (_focus.isFocus()) {
                g.setBackgroundColor(Color.LIGHTBLUE);
              } else {
                g.setBackgroundColor(Color.WHITE);
              }
              g.clear();
              g.setBackgroundColor(prevBg);
            }
    
    }
    

    DEVICE BLACKBERRY BOLD 9780

    One thing to try is to substitute drawFocus do nothing:

    protected void drawFocus(Graphics g, boolean on) {
    }
    

    But the main problem must be somewhere in your sublayout substitutions. First of all, I am always wary with the help of a manager not abstract, never by calling its sublayout (such as super.sublayout). If you want to do this, substitute rather Manager. If your

    bmpRowMan =  new VerticalFieldManager(){
    

    should become

    bmpRowMan =  new Manager(){
    

    Another problem (this is not obvious and is repeated a lot of different people here) is using setExtent after the super.sublayout of a built-in Manager. Simply put - don't! If you change the width and height parameters before you go super.sublayout and want the Manager to have these exact width and height, set it with USE_ALL_WIDTH and USE_ALL_HEIGHT and filing the setExtent altogether! You pouvez use setExtent after super.sublayout, but you really need to know why you do this. An example is the code for this article in the knowledge base, but it feels more like a hack, you don't need:

    Implementation of a standard style scroll bar

    Good luck!

  • Custom development/unfocus listfield problem

    Hi guys,.

    I followed and adapted a few custom listfield and produced the code below. The layout fields works exactly as I intended, however, I ran into problems to repaint when the focus changes as I scroll around the fields.

    Scroll down the first elements in the list, focus changes as it should. When the focus switches to the listfield, who is at the bottom of the screen (as in the last field that is displayed, not necessarily the last field in the list), the target element is displayed correctly, but the text of all the other fields is preparing to the color that the target text must be. The fuzzy text remains then the color targeted until I do scroll up even once, when he again changes in how it should be.

    Sorry if it is not very clear... I can post screenshots if it's not understandable!

    The code used is the following:

    ListField custom

    public class MatchListField extends ListField implements FieldChangeListener
    {
        private boolean hasFocus;
        private static final int LIGHT_TEXT  = 0xe6ce03;
        private static final int DARK_TEXT  = 0x054b93;
        private final int[] cols = new int[]{ 0xe6ce03, 0xf9f1af, 0xf9f1af, 0xe6ce03 };
    
        public MatchListField()
        {
            super();
            setRowHeight( 50 );
        }   
    
        public int moveFocus(int amount, int status, int time)
        {
            invalidate();
            return super.moveFocus(amount,status,time);
        }
    
        public boolean isFocusable()
        {
            return true;
        }
    
        //Invoked when this field receives the focus.
        protected void onFocus(int direction)
        {
            hasFocus = true;
            super.onFocus(direction);
            invalidate();
        }
    
        //Invoked when a field loses the focus.
        protected void onUnfocus()
        {
            hasFocus = false;
            super.onUnfocus();
        }
    
        protected void paint( Graphics graphics )
        {
            //Get the current clipping region as it will be the only part that requires repainting
            XYRect redrawRect = graphics.getClippingRect();
            if(redrawRect.y < 0)
            {
                throw new IllegalStateException("Clipping rectangle is wrong.");
            }
    
            //Determine the start location of the clipping region and end.
            int rowHeight = getRowHeight();
    
            int curSelected;
    
            //If the ListField 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() );
            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, getPreferredWidth(), getPreferredWidth(), 0};     
    
            //Draw each row
            for( ; startLine <= endLine; startLine++ )
            {
                if (startLine != curSelected)
                {
                    //Draw the non selected rows.
                    graphics.setColor( LIGHT_TEXT );
                    super.paint( graphics );
                }
                else
                {
                    //Draw the selected rows.
                    graphics.drawShadedFilledPath( xInds, yInds, null, cols, null );
                    graphics.setColor( DARK_TEXT );
                    super.paint( graphics );
                }
                //Assign new values to the y axis moving one row down.
                y += rowHeight;
                yInds[0] = y;
                yInds[1] = yInds[0];
                yInds[2] = y + rowHeight;
                yInds[3] = yInds[2];
    
            }
        }
    }
    

    Custom ListFieldCallback:

    public class MatchListCallback implements ListFieldCallback {
    
        private Vector _listElements = new Vector();
    
        public void drawListRow(ListField listField, Graphics graphics, int index, int y, int width)
        {
            MatchListField matchList = ( MatchListField ) listField;
            MatchListRowManager rowManager = ( MatchListRowManager ) _listElements.elementAt( index );
            rowManager.drawRow( graphics, 0, y, width, matchList.getRowHeight() );
        }
    
        //Returns the object at the specified index.
        public Object get(ListField list, int index)
        {
            return _listElements.elementAt(index);
        }
    
        //Returns the first occurence of the given String, bbeginning the search at index,
        //and testing for equality using the equals method.
        public int indexOfList(ListField list, String p, int s)
        {
            //return listElements.getSelectedIndex();
            return _listElements.indexOf(p, s);
        }
    
        //Returns the screen width so the list uses the entire screen width.
        public int getPreferredWidth(ListField list)
        {
            return Display.getWidth();
        }
    
        //Adds a String element at the specified index.
        public void insert( String homeTeam, String awayTeam, int homeGoals, int awayGoals )
        {
            MatchListRowManager row = new MatchListRowManager();
            Bitmap badge1 = Bitmap.getBitmapResource( homeTeam + ".png" );
            Bitmap badge2 = Bitmap.getBitmapResource( awayTeam + ".png" );
    
            row.add( new BitmapField( badge1 ) );
            row.add( new LabelField( homeTeam, LabelField.USE_ALL_WIDTH | LabelField.ELLIPSIS ));
            row.add( new LabelField( homeGoals + " - " + awayGoals, LabelField.USE_ALL_WIDTH | LabelField.ELLIPSIS | DrawStyle.HCENTER ));
            row.add( new LabelField( awayTeam, LabelField.USE_ALL_WIDTH | LabelField.ELLIPSIS | LabelField.RIGHT ));
            row.add( new BitmapField( badge2 ) );
    
            _listElements.addElement( row );
        }
    
        //Erases all contents.
        public void erase()
        {
            _listElements.removeAllElements();
        }
    
    }
    

    The manager used for individual fields of page layout that make up each listfield:

    public class MatchListRowManager extends Manager
    {
    
        public MatchListRowManager()
        {
            super( 0 );
        }
    
        public void drawRow( Graphics g, int x, int y, int width, int height )
        {
            layout( width, height );
            setPosition( x, y );
            g.pushRegion( getExtent() );
            subpaint( g );
    
            g.popContext();
        }
    
        protected void sublayout(int width, int height )
        {
            int preferredWidth = getPreferredWidth();
    
            //badge 1 field
            Field field = getField( 0 );
            layoutChild( field, 40, 40 );
            setPositionChild( field, 0, 5 );
    
            //home team field
            field = getField( 1 );
            layoutChild( field, ( preferredWidth - 160 ) / 2, 40 );
            setPositionChild( field, 42, 10 );
    
            //score field
            field = getField( 2 );
            layoutChild( field, 80, 40 );
            setPositionChild( field, 42 + ( preferredWidth - 164 ) / 2, 10 );
    
            //away team field
            field = getField( 3 );
            layoutChild( field, ( preferredWidth - 160 ) / 2, 40 );
            setPositionChild( field, 42 + 80 + ( preferredWidth - 164 ) / 2, 10 );
    
            //badge2 field
            field = getField( 4 );
            layoutChild( field, 42, 40 );
            setPositionChild( field, preferredWidth - 40, 5 );
    
            setExtent( preferredWidth, getPreferredHeight() );
        }
    
        public int getPreferredWidth()
        {
            return Display.getWidth();
        }
    
        public int getPreferredHeight()
        {
            return 50;
        }
    
    }
    

    I've tested this using the Bold 9700 Simulator with the API 5.0.

    I had a quick glance at some of the other posts about personalized listfields and have had no joy to find a solution so far. I would be grateful if someone could point me in the right direction here.

    I only have a few months of experience with Java programming, and very little experience developing for BlackBerry, so if there are no other pointers of how I could put this implementation, then that would be most appreciated.

    Thanks in advance!

    Suddenly appeared to me...

    Use this.getCallback () to get the instance of MatchListCallback and then replaced two calls super.paint (graph) with:

    callBack.drawListRow (this, graphics, startLine, xInds [0]);

    Problem solved.

    Thanks for the help, he led me on the right track!

  • ListField SetFocus

    I tried

    list.setFocus ();

    1 blue

    2 Red

    -> 3. Green

    4 Rose

    5 Brown

    6 gray

    I can able to set the focus to the listField custom control but I need to set the focus to the element of particular color in the default list "3. Green."

    How to set the focus to the particular element of the listField?

    Use the setFocus() and setSelectedIndex() of ListField.

  • Implementing custom listener for ListField

    I'm trying to implement a listener for a custom field I created that would launch a new screen when you click on the field. However, nothing happens when I click on the custom field. I use BlackBerry Java plug-in for Eclipse, JDK 1.3 and JRE 6.0. All my code is attached. MyScreen.java contains the code where I'm trying to implement a function fieldChanged.

    //MyApp.Java
    
    package mypackage;
    
    import net.rim.device.api.system.CodeModuleManager;
    import net.rim.device.api.ui.UiApplication;
    
    /**
     * This class extends the UiApplication class, providing a
     * graphical user interface.
     */
    public class MyApp extends UiApplication
    {
        /**
         * Entry point for application
         * @param args Command line arguments (not used)
         */
        public static void main(String[] args)
        {
            CodeModuleManager.promptForResetIfRequired();
    
            // Create a new instance of the application and make the currently
            // running thread the application's event dispatch thread.
            MyApp theApp = new MyApp();
            theApp.enterEventDispatcher();
        }
    
        /**
         * Creates a new MyApp object
         */
        public MyApp()
        {
            // Push a screen onto the UI stack for rendering.
            pushScreen(new MyScreen());
        }
    }
    
    //MyScreen.java
    
    package mypackage;
    
    import net.rim.device.api.ui.container.*; //for vertical manager
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FieldChangeListener;
    import net.rim.device.api.ui.Manager;
    //import net.rim.device.api.ui.Screen;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.decor.BackgroundFactory;
    
    /**
     * A class extending the MainScreen class, which provides default standard
     * behavior for BlackBerry GUI applications.
     */
    public final class MyScreen extends MainScreen
    {
        /**
         * Creates a new MyScreen object
         */
        private CustomField cField;
    
        public MyScreen()
        {
            // Set the displayed title of the screen
            setTitle("My New App");
    
            cField = new CustomField("4.PNG","This is my 4th custom field!!");
            ButtonClickListener listener = new ButtonClickListener();
            cField.setChangeListener(listener);
            add(cField);
    
        }//MyScreen function
    
        class ButtonClickListener implements FieldChangeListener
        {
            public void fieldChanged(Field field, int context)
             {
                  //we need to determine which button was clicked
    
                  if(field == cField)
                      new SpeedBumpScreen();
    
             }
    
        }//ButtonClickListener
    
    }
    
    //CustomField.java
    
    package mypackage;
    
    import java.util.Vector;
    
    import net.rim.device.api.system.Bitmap;
    import net.rim.device.api.ui.*;
    import net.rim.device.api.ui.component.*;
    
    class CustomField extends ListField implements ListFieldCallback {
        private Vector rows;
    
        public CustomField(String customImg, String customLabel) {
            super(0, ListField.MULTI_SELECT);
            setRowHeight(80);
            setEmptyString("Hooray, no items here!", DrawStyle.HCENTER);
            //setCallback(this);
    
            Bitmap p1 = Bitmap.getBitmapResource(customImg); 
    
            rows = new Vector();
    
            TableRowManager row = new TableRowManager();
    
            row.add(new BitmapField(p1));
    
            // SET THE item NAME LABELFIELD
            // if overdue, bold/underline
            LabelField item = new LabelField("item #" + customLabel,
                DrawStyle.ELLIPSIS);
    
            // overdue
            item.setFont(Font.getDefault().derive(
                Font.BOLD | Font.UNDERLINED));
            System.out.println("OVERDUE");
    
            row.add(item);
    
            // SET THE LIST NAME
            row.add(new LabelField("List Name #" + String.valueOf(1),
                DrawStyle.ELLIPSIS) {
                protected void paint(Graphics graphics) {
                    graphics.setColor(0x00878999);
                    super.paint(graphics);
                }
            });
    
            // SET THE DUE DATE/TIME
            row.add(new LabelField("Due Date #" + String.valueOf(1),
                    DrawStyle.ELLIPSIS | LabelField.USE_ALL_WIDTH
                    | DrawStyle.RIGHT) {
                protected void paint(Graphics graphics) {
                    graphics.setColor(0x00878787);
                    super.paint(graphics);
                }
            });
    
            rows.addElement(row);
    
            setSize(rows.size());
    
        } //end public CustomField()
    
        // ListFieldCallback Implementation
        public void drawListRow(ListField listField, Graphics g, int index, int y,
                int width) {
            CustomField list = (CustomField) listField;
            TableRowManager rowManager = (TableRowManager) list.rows
                .elementAt(index);
            rowManager.drawRow(g, 0, y, width, list.getRowHeight());
        } //end drawListRow()
    
        private class TableRowManager extends Manager {
    
            public TableRowManager() {
                super(0);
            } //end pulic TableRowManager
    
            // Causes the fields within this row manager to be layed out then
            // painted.
            public void drawRow(Graphics g, int x, int y, int width, int height) {
                // Arrange the cell fields within this row manager.
                layout(width, height);
    
                // Place this row manager within its enclosing list.
                setPosition(x, y);
    
                // Apply a translating/clipping transformation to the graphics
                // context so that this row paints in the right area.
                g.pushRegion(getExtent());
    
                // Paint this manager's controlled fields.
                subpaint(g);
    
                g.setColor(0x00CACACA);
                g.drawLine(0, 0, getPreferredWidth(), 0);
    
                // Restore the graphics context.
                g.popContext();
            }//end drawRow()
    
            // Arranges this manager's controlled fields from left to right within
            // the enclosing table's columns.
            protected void sublayout(int width, int height) {
                // set the size and position of each field.
                int fontHeight = Font.getDefault().getHeight();
                int preferredWidth = getPreferredWidth();
    
                // start with the Bitmap Field of the priority icon
                Field field = getField(0);
                layoutChild(field, 32, 32);
                setPositionChild(field, 0, 0);
    
                // set the item name label field
                field = getField(1);
                layoutChild(field, preferredWidth - 16, fontHeight + 1);
                setPositionChild(field, 34, 3);
    
                // set the list name label field
                field = getField(2);
                layoutChild(field, 150, fontHeight + 1);
                setPositionChild(field, 34, fontHeight + 6);
    
                // set the due time name label field
                field = getField(3);
                layoutChild(field, 150, fontHeight + 1);
                setPositionChild(field, preferredWidth - 152, fontHeight + 6);
    
                setExtent(preferredWidth, getPreferredHeight());
            }//end sublayout()
    
            // The preferred width of a row is defined by the list renderer.
            public int getPreferredWidth() {
                return Graphics.BLACK;
            }
    
            // The preferred height of a row is the "row height" as defined in the
            // enclosing list.
            public int getPreferredHeight() {
                return getRowHeight();
            }
    
        }// private class TableRowManager extends Manager 
    
        public Object get(ListField listField, int index) {
            // TODO Auto-generated method stub
            return null;
        }
    
        public int getPreferredWidth(ListField listField) {
            // TODO Auto-generated method stub
            return 0;
        }
    
        public int indexOfList(ListField listField, String prefix, int start) {
            // TODO Auto-generated method stub
            return 0;
        }
    
    } //end class CustomField extends ListField implements ListFieldCallback
    
    //SpeedBumpScreen.java
    
    package mypackage;
    
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.component.RichTextField;
    import net.rim.device.api.ui.container.MainScreen;
    
    public final class SpeedBumpScreen extends MainScreen
    {
        /**
         * Creates a new HelloWorldScreen object
         */
        SpeedBumpScreen()
        {
            // Set the displayed title of the screen
            setTitle("Speed bump screen");
    
            // Add a read only text field (RichTextField) to the screen.  The
            // RichTextField is focusable by default. Here we provide a style
            // parameter to make the field non-focusable.
            add(new RichTextField("This is the speed bump screen!", Field.NON_FOCUSABLE));
        }
    
    }
    

    In addition, there is nothing in the ListField that will actually generate an event.

    Here is a simple extension to the ListField which will make "clickable".  In your FieldChangeListener you can use getSelectedindex to determine which line has the focus.

    Please ask if this isn't clear:

    public class ClickableListField extends ListField {
    
        public ClickableListField(int numberOfRows) {
            super(numberOfRows);
        }
    
        protected boolean navigationClick(int status, int time) {
            this.fieldChangeNotify(2);
            return true;
        }
    
        protected boolean touchEvent(TouchEvent message) {
            int x = message.getX( 1 );
            int y = message.getY( 1 );
            if( x < 0 || y < 0 || x > getExtent().width || y > getExtent().height ) {
                    // Outside the field
                    return false;
            }
            // If click, process Field changed
            if ( message.getEvent() == TouchEvent.CLICK ) {
                this.fieldChangeNotify(2);
                return true;
            }
            return super.touchEvent(message);
        }
    
    }
    
  • more UI questions. Custom LabelField and ListField text positioning

    Hello

    I have two questions.

    1. I implement a LabelField, and I want to be the width of the screen and the text to be in the middle of its width. I am implemented with these bits of style: DrawStyle.HCENTER | DrawStyle.VCENTER | Field.FOCUSABLE | Field.FIELD_HCENTER. Then I overload layout() with this:

    public void layout(int width, int height) {
                    super.layout(width, height);
                    setExtent(Display.getWidth(), this.getPreferredHeight());
                }
    

    The result is that the width of the field extends across the width of the screen, but the text is left-aligned. What I am doing wrong?

    2. I've implemented a ListField personalized with a custom drawListRow(). For some reason, the color of the text in the highlighted line remains black. I don't know what I did wrong. I was expecting that there the default highlight a behavior, which is thoroughly blue, white text.

    Thank you

            public int moveFocus(int amount, int status, int time) {
                _listField.invalidate(getSelectedIndex());
                return super.moveFocus(amount,status,time);
            }
    
            //Invoked when this field receives the focus.
            public void onFocus(int direction) {
                super.onFocus(direction);
            }
    
            //Invoked when a field loses the focus.
            public void onUnfocus() {
                super.onUnfocus();
                _listField.invalidate(getSelectedIndex());
            }
    

    In my ListFields sexy do Paint (usually different color according to the status background), I use a substituted ListField that invalidates whenever he thinks he needs to, the idea being that it forces the line to be redrawn.

    I'm not confident in them, but they do not seem to work.  It's code that I created when I started it first, I didn't need to change so I don't have, but I'd be very confident that it is not optimal.

    OK, so you know this code comes with no warranty.

    I have replaced three routines as follows:

  • Customizing the background color for an element ListField

    I spent the better half of today trying to figure out how to set the background color for when a ListField element has the focus. I tried the substitution of paint and drowFocus and can not get any color other than the default.

    Someone knows how to do this?

    Try something like that.

     public void drawListRow(ListField list, Graphics g, int index, int y, int w)
    {
        if(list.getSelectedIndex() == index)
        {
             g.setColor(0x0000FF);
             g.fillRect(0,(index*rowHight),rowWidth,rowHeight);
             g.setColor(0x000000);
        }
        g.drawText("Text", 0, y, 0, w);
    }
    

    PS: Call disabled, if the previous paint stays on the screen.

  • Height of row custom setting ListField shaped on 9000 &amp; 9530

    Hello

    I use the method setRowHeight (int, int) to set the height of a row in a custom list field. It works perfectly in all models except the 9000 and 9530. In these two model, it seems that she ignores my call to the method and it does not change the height.

    Everyone knows this or have a possible solution?

    Greg

    Wow I feel stupid, it was formatted correctly. The screen size is just bigger and I changed the wrong font size so it appeared smaller.

  • How to improve the search function on a VerticalFieldManager that contains custom managers

    I have a screen with a VerticalFieldManager for a list of custom managers holding.

    The screen also contains an EditField that behaves like a search field, when the user enters the text, my app looping through an array of custom managers and compares the text entered with the text of all managers in the table.

    If the text of a Manager matches the input string, I add this handler to the VerticalFieldManager.

    Here are the relevant parts of my code:

    EditField _editField.
    TempBeanPlaces [] _placesList;
    VerticalFieldManager _vfmCellPlaces;

    ....

    This is the constructor of TemBeanPlaces:

    public TempBeanPlaces (String pPlaceName, CellPlaceManager pCellPlaceManager) {}
    placeName = pPlaceName;
    cellPlaceManager = pCellPlaceManager;
    }
    ...

    And this code handles the research:

    _editField.setChangeListener (new FieldChangeListener() {}
    ' Public Sub fieldChanged (field field, int context) {}
    String text = _editField.getText () .toLowerCase ();
    _vfmCellPlaces.DeleteAll ();
    for (int i = 0; i)< _placeslist.length;="" i++)="">
    TempBeanPlaces tempBeanPlaces = _placesList [i];
    If (tempBeanPlaces.getPlaceName () .toLowerCase (). IndexOf (Text)! = -1) {}
    _vfmCellPlaces.Add (tempBeanPlaces.getCellPlaceManager ());
    }
    }
    updateLayout();
    }
    });

    This works well when the _placesList table is not too big (length of 50, for example), otherwise the application becomes too slow.

    How can I optimize my code for large quantities of custom managers? For example, in the case, the table contains 600 elements.

    I really need to improve this feature. I just read on the ListField in BlackBerry, but since I have this code, maybe I need to rewrite all with ListFields.

    Thanks in advance!

    The biggest problem with update fields as it is time to layout, fields that are added.  If you add such a moment, then each addition will cause a layout.  Instead, you use addAll to add an array of items, or you can also add all of your items to a single Manager, and then add the Manager.  Then the layout occurs only once.

    In your code, the option would be to add managers selected to a vector, transform the vector into an array, then use addAll.

    You don't need the updateLayout().

    That said, more you add them fields, more processing will be available anyway, then perhaps you are trying to add more elements than even this optimization will execute quickly.  If this optimization does not work enough, then you will need to look in a different way, say 'paging' results, then the display doesn't show that the top 25 and the user can 'add more '.  This 'Exchange' is a good approach in my experience, because users will rarely scroll 25, when they can make another research that could give them better results.

    Finally, and to be on par with the comment of Simon, ListField is an extremely effective area because it is a unique field, so layout is easy, and he's not trying to paint lines until they are actually displayed on the screen.  So in your case, you have three options:

    (1) addAll

    (2) paging

    (3) ListField

    Let us know how you go.

  • view the json data in the custom list field

    Hi, I did analysis json and I created the custom list field. Now, I want to display only the data analyzed in my custom list field. I'll post my analyzed data from json and here is the code for my custom list field
    data analyzed.
    I have THREE channels of json and I want to show content tittle and date in the list filed. I'll post the screenshot of my list.

    JSONArray jsnarry = new JSONArray(responce);
                System.out.println("\n--length----- "+jsnarry.length());
                //System.out.println("....................................................=");
                for (int i = 0; i < jsnarry.length(); i++){
    
                    JSONArray inerarray = jsnarry.getJSONArray(i);
                        //System.out.println("\n-inerarray-values----- "+inerarray.getString(i1));
                        String TITTLE = inerarray.getString(1);
                        String CONTENT = inerarray.getString(2);
                        String DATE = inerarray.getString(3);
                                                           System.out.println("TITTLE= "+TITTLE);
                        System.out.println("CONTENT= "+CONTENT);
                        System.out.println("DATE= "+DATE);
    
    }
    

    output

    [0.0] --length----- 2
    [0.0]
    [0.0] -innerarray-length----- 6
    
    [0.0] TITTLE= BJP State President Sanjay Tandon's visit to Amita Shukla's Home
    [0.0] CONTENT=  BJP President Chandigarh Sanjay Tandon at Amita Shukla's Home
    [0.0] DATE= 2013-01-04
    [0.0] ................................................
    [0.0] TITTLE= Sanjay Tandon at mahasamadhi of Satya Shri Sai baba.
    [0.0] CONTENT= BJP Chandigarh President, Sanjay Tandon mahasmadhi of Sri Satya Sai Baba.(Andhra Pradesh)
    [0.0] DATE= 2013-01-13
    

    and my custom list field

           super(NO_VERTICAL_SCROLL);
    
             String TITTLE="TITTLE";
             String CONTENT = "CONTENT";
             String DATE = "DATE";
    
             v.addElement(new ListRander(listThumb, TITTLE, CONTENT,DATE, navBar));
    
             myListView = new CustomListField(v){
    
                 protected boolean navigationClick(int status, int time) {
                     //Dialog.alert(" time in milisec :" + time);
                     return true;
                 }
             };
    

    CustomListField.java

    public class CustomListField extends ListField implements ListFieldCallback {
    
        private Vector _listData;
        private int _MAX_ROW_HEIGHT = 100;
    
        public CustomListField (Vector data) {
    
            _listData = data;
            setSize(_listData.size());
            setSearchable(true);
            setCallback(this);
            setRowHeight(_MAX_ROW_HEIGHT);
    
        }
    
        public int moveFocus (int amount, int status, int time) {
    
            this.invalidate(this.getSelectedIndex());
            return super.moveFocus(amount, status, time);
    
        }
    
        public void onFocus (int direction) {
    
            super.onFocus(direction);
    
        }
    
        protected void onUnFocus () {
    
            this.invalidate(this.getSelectedIndex());
    
        }
    
        public void refresh () {
    
            this.getManager().invalidate();
    
        }
    
        public void drawListRow (ListField listField, Graphics graphics, int index, int y, int w) {
    
            ListRander listRander = (ListRander)_listData.elementAt(index);
            graphics.setGlobalAlpha(255);
            graphics.setFont(Font.getDefault().getFontFamily().getFont(Font.PLAIN, 24));
            final int margin =5;
    
            final Bitmap thumb= listRander.getListThumb();
            final String listHeading = listRander.getListTitle();
            final String listDesc= listRander.getListDesc();
            final String listDesc2= listRander.getListDesc2();
            final Bitmap nevBar = listRander.getNavBar();
    
            //list border
            graphics.setColor(Color.BLACK);
            graphics.drawRect(0, y, w, _MAX_ROW_HEIGHT);
    
            graphics.drawBitmap(margin, y+margin+10, thumb.getWidth(), thumb.getHeight(), thumb, 0, 0);
    
            graphics.drawText(listHeading, 3*margin+thumb.getWidth(), y+margin);
            graphics.setColor(Color.BLACK);
    
            graphics.drawText(listDesc, 3*margin+thumb.getWidth(), y+ margin+30);
            graphics.drawText(listDesc2, 3*margin+thumb.getWidth(), y+ margin+60);
    
        }
    
        public Object get(ListField listField, int index) {
    
            String rowString = (String) _listData.elementAt(index);
            return rowString;
    
        }
    
        public int indexOfList (ListField listField, String prefix, int start) {
    
            for (Enumeration e = _listData.elements(); e.hasMoreElements(); ) {
    
                String rowString = (String) e.nextElement();
                if (rowString.startsWith(prefix)) {
    
                    return _listData.indexOf(rowString);
    
                }
    
            }
    
            return 0;
    
        }
    
        public int getPreferredWidth(ListField listField) {
    
            return 3 * listField.getRowHeight();
    
        }
    
    }
    

    Listrander.Java

    public class ListRander {}

    private bitmap listThumb = null;
    incognito bar Bitmap = null;
    private String listTitle = null;
    private String listDesc = null;
    private String listDesc2 = null;

    public ListRander (Bitmap listThumb, String listTitle, String listDesc, String listDesc2, Bitmap navBar) {}
    this.listDesc = listDesc;
    this.listDesc2 = listDesc2;
    this.listThumb = listThumb;
    this.listTitle = listTitle;
    this.navBar = bar navigation;
    }
    public getListThumb() {Bitmap image
    Return listThumb;
    }
    {} public void setListThumb (listThumb Bitmap)
    this.listThumb = listThumb;
    }
    public getNavBar() {Bitmap image
    return the navigation bar;
    }
    {} public void setNavBar (navigation bar of the Bitmap)
    this.navBar = bar navigation;
    }
    public String getListTitle() {}
    Return listTitle;
    }
    {} public void setListTitle (String listTitle)
    this.listTitle = listTitle;
    }
    public String getListDesc() {}
    Return listDesc;
    }
    {} public void setListDesc (String listDesc)
    this.listDesc = listDesc;
    }
    public String getListDesc2() {}
    Return listDesc2;
    }
    public void setListDesc2 (String listDesc2) {}
    this.listDesc2 = listDesc2;
    }
    }

    You seem to have two problems here and are confusing them.  You must break the problem into two parts

    (1) extract the data from the entry and create the objects you want to display

    2) display in a list, a set of objects.

    Let's get the sorted first premiera.

    I will suggest what to do here, but in practice, you might actually think about this yourself as part of the design phase of your application.  You should do this, not me, because then you will have all the information available.  At the present time, I have just what you said, which is not much.  So maybe what I'm telling you is not correct for your application.  Only you can decide that.  And be blunt here, you should have decided this before you start coding.  Do you want you could lead down the wrong path.  You must think of your application as a home - as the architect must design all the rooms, and how they will be built, before you start building the House.  You do not, then we are building the rooms on the fly.  Who knows if they will be fit at home?

    In this case, I think you need to create an object that represents each of the elements in the internal array of new data.  call this object

    NewsItem

    This object will have attributes, such as its title, content, date, the linked image and so on, each of whom have will get and set methods.  While you treat each inner element fetch you the associated entry and update the object.

    When you have finished the inner loop of processing, you now have a complete

    NewsItem

    Object, so you will add it to a collection, an array of NewsItem objects, call this _newsItems.  You will create it at the beginning - you know how many entries it takes because it is the number of entries in your outdoor table.

    So before you start to deal with JSON, create your table and the 'index' value of 0.

    Once you have created your Newsitem, add this in the table to the position 'index' and increment "index".

    And once you have analyzed all the JSON, you will have a complete picture.  This is part 1 finished!

    And note in your drawListRow, you are given a clue - that is the index in your tables in _newsItems.  So you can easily find which entry to view and display it correctly.  But it is part 2 and is a separate issue.

  • Problem with fieldChanged() and custom button field

    Hello

    I created a custom button class by extending LabelField.  I chose LabelField over field because the LabelField contains desirable properties that are already being implemented.  The only problem I'm having has to do with the change listener.  It seems to 'steal' the event click on other areas in my application.

    For example, when I click on the custom button, a popupscreen with a listfield opens. When I click on an item in the listfield, then the fieldChanged() of custom button is called again...

    Can you see anything wrong with my code?

    package com.rantnetwork.fields;
    
    import com.rantnetwork.app.Constants;
    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.Ui;
    import net.rim.device.api.ui.XYEdges;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.decor.BackgroundFactory;
    import net.rim.device.api.ui.decor.BorderFactory;
    
    public class CustomButtonField extends LabelField {
    
        private boolean highlighted = false;
    
        public CustomButtonField(String text, long style) {
            super(text, style | Field.FOCUSABLE | LabelField.ELLIPSIS);
    
            setPadding(10, 0, 10, 5);
    
            setFont(Font.getDefault().derive(Font.BOLD,
                    Constants.DEFAULT_FONT_SIZE, Ui.UNITS_pt));
    
            setBackground(BackgroundFactory.createLinearGradientBackground(
                    0x163d7c, 0x163d7c, 0x03162d, 0x03162d));
            setBorder(BorderFactory
                    .createBevelBorder(new XYEdges(1, 1, 1, 1), new XYEdges(
                            Color.BLACK, Color.BLACK, Color.BLACK, Color.BLACK),
                            new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK,
                                    Color.BLACK)));
    
        }
    
        public int getPreferredWidth() {
            return Display.getWidth() / 3;
        }
    
        protected void paint(Graphics graphics) {
            graphics.setColor(Color.WHITE);
            super.paint(graphics);
        }
    
        protected void drawFocus(Graphics graphics, boolean on) {
            // Do nothing
        }
    
        protected boolean navigationClick(int status, int time) {
            fieldChangeNotify(1);
            return true;
        }
    
        protected void onFocus(int direction) {
            if (!highlighted) {
                setBackground(BackgroundFactory.createLinearGradientBackground(
                        0x4bb7df, 0x4bb7df, 0x1b96da, 0x1b96da));
                setBorder(BorderFactory.createBevelBorder(new XYEdges(1, 1, 1, 1),
                        new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK,
                                Color.BLACK), new XYEdges(Color.BLACK, Color.BLACK,
                                Color.BLACK, Color.BLACK)));
            }
        }
    
        protected void onUnfocus() {
            if (!highlighted) {
                setBackground(BackgroundFactory.createLinearGradientBackground(
                        0x163d7c, 0x163d7c, 0x03162d, 0x03162d));
                setBorder(BorderFactory.createBevelBorder(new XYEdges(1, 1, 1, 1),
                        new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK,
                                Color.BLACK), new XYEdges(Color.BLACK, Color.BLACK,
                                Color.BLACK, Color.BLACK)));
            }
        }
    
        public void showHighlighted(boolean focus) {
            if (focus) {
                highlighted = true;
                setBackground(BackgroundFactory.createLinearGradientBackground(
                        0x4bb7df, 0x4bb7df, 0x1b96da, 0x1b96da));
                setBorder(BorderFactory.createBevelBorder(new XYEdges(1, 1, 1, 1),
                        new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK,
                                Color.BLACK), new XYEdges(Color.BLACK, Color.BLACK,
                                Color.BLACK, Color.BLACK)));
            } else {
                highlighted = false;
                setBackground(BackgroundFactory.createLinearGradientBackground(
                        0x163d7c, 0x163d7c, 0x03162d, 0x03162d));
                setBorder(BorderFactory.createBevelBorder(new XYEdges(1, 1, 1, 1),
                        new XYEdges(Color.BLACK, Color.BLACK, Color.BLACK,
                                Color.BLACK), new XYEdges(Color.BLACK, Color.BLACK,
                                Color.BLACK, Color.BLACK)));
            }
            invalidate();
        }
    
        public boolean isHighlighted() {
            return highlighted;
        }
    
    }
    

    behrk2 wrote:

    Now, I'm not sure why customButton.setText (calling) would trigger the fieldChanged().  Can anyone think of a reason why he can do?

    Thank you!

    Can you think of a reason why we can't do that? The field has changed, after all! Of course, the context (second argument to fieldChanged) will be PROGRAMMATIC in this case, that might be a pretty good indication for you. But not invoke fieldChanged at all would be wrong.

    This is why I don't like the idea of extending LabelField and not just the field for your custom badges - you have much less control over his behavior. If you want an example showing how to create abstract off-screen buttons, take a look at BaseButtonField and his descendants in managers, fields and advanced buttons.

  • Touch anywhere on the screen calls the ListField TouchEvent.DOWN

    Hello

    I suffer with small complex issue. In the screen of my application, I have the title bar with a labelfield and two custom buttons.

    Below the titlefield I add a list field.

    Now, I have a few complex features on the field from the list. When I click each line in the list, it should move to another screen I do using navigation, click medium. Now if I touch the rank in the list (for touch devices), it should move to another screen. And if I touch along the line of the list, it will display popup menu (custom, not by default) with option of removal and details.

            mListItem = new ListField(length, ButtonField.CONSUME_CLICK)
            {
                long touchedAt = -1;
                long HOLD_TIME = 500;
    
             // The regular getFieldAtLocation returns wrong values in open
                        // spaces in
                        // complex managers, so we override it
    //                  public int getFieldAtLocation(int x, int y) {
    //                      XYRect rect = new XYRect();
    //                      int index = getFieldCount() - 1;
    //                      while (index >= 0) {
    //                          getField(index).getExtent(rect);
    //                          if (rect.contains(x, y))
    //                              break;
    //                          --index;
    //                      }
    //                      return index;
    //                  }
                protected boolean navigationClick(int status, int time)
                {
                    // Click related functionality
                    return true;
                }
    
                protected boolean touchEvent(TouchEvent message)
                {
                    if(message.getEvent() == TouchEvent.DOWN)
                    {
                         if (getFieldAtLocation(message.getX(1), message.getY(1)) == -1)
                         {
                             Logger.out("AccountList", "Touch down: getField location");
                             return true; // kill the event
                         }
                         else
                         {
                             touchedAt = System.currentTimeMillis();
                             touchedonList = true;
                             Logger.out("AccountList", "Touch down: touched down  "+touchedonList);
                         }
                    }
                    else if(message.getEvent() == TouchEvent.UP )
                    {
    
                           if(System.currentTimeMillis() - touchedAt < HOLD_TIME && touchedonList == true)
                           {
                               touchedAt = -1; // reset
                               // Single Touch and Move to another screen
                           }
    
                           else if(touchedonList == true)
                           {
                             // Showing Menu Popup
                           }
                    }
                    return true;
    //              return super.touchEvent(message);  // Not using this as it will show the default pop up
                }
    

    And here's my reminder list field:

    public class ListCallBack implements ListFieldCallback
        {
            public void drawListRow(ListField listField, Graphics graphics, int index,
                    int y, int width) {
    
                String strdomOrg = yyyyyyy;
                String text = xxxxxx;
                Font f = FONT_FAMILY_0_SF_AS_08;
    
                int h = f.getHeight();
    //          int height = (listField.getRowHeight() - h)/2 ;
                int height = h/2 ;
                y += height;
                graphics.setFont(f);
                graphics.setColor(Color.BLACK);
                graphics.drawText(strdomOrg, 10, y, DrawStyle.ELLIPSIS, width);
                y = y + h;
                graphics.setFont(FONT_FAMILY_1_SF_AS_08);
                graphics.setColor(Color.BLACK);
                graphics.drawText(text, 10, y, DrawStyle.ELLIPSIS , width);
    
             // use the offset instead
                int offset = (listField.getRowHeight() ) >> 1;
                if (index != 0) {
                    graphics.drawLine(0, y - offset , width, y - offset);
                }
            }
    
            public Object get(ListField listField, int index) {
                // TODO Auto-generated method stub
                return mAccounts[index];
            }
    
            public int getPreferredWidth(ListField listField) {
                // TODO Auto-generated method stub
                return screenWidth;
            }
    
            public int getPreferredHeight() {
                return getContentHeight();
            }
    
            public int indexOfList(ListField listField, String prefix, int start) {
                // TODO Auto-generated method stub
                return listField.getSelectedIndex();
            }
    
        }
    

    Now the question is to come a different way:

    1. whenever I touch the buttons in title field, he calls the listfield TouchEvent.DOWN. Then the click of a button does not work. Instead, by clicking on the title bar, it moves to another screen, which is the feature click list filed.

    2. so I added the listfield at a value for money. :

    m_vfmScreen = new VerticalFieldManager(VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR)
            {
    
            protected boolean touchEvent(TouchEvent message) {
                    int event = message.getEvent();
                    if (event == TouchEvent.CLICK) {
                        if (getFieldAtLocation(message.getX(1), message.getY(1)) == -1)
                            return true; // kill the event
                        else {
                        }
                    }
                    return super.touchEvent(message);
                }
    
                // The regular getFieldAtLocation returns wrong values in open
                // spaces in
                // complex managers, so we override it
                public int getFieldAtLocation(int x, int y) {
                    XYRect rect = new XYRect();
                    int index = getFieldCount() - 1;
                    while (index >= 0) {
                        getField(index).getExtent(rect);
                        if (rect.contains(x, y))
                            break;
                        --index;
                    }
                    return index;
                }
            };
    

    While in the list key of field works. If I touch the buttons in the title bar, it does not. But if the keys become focus, this case they work.

    So I am in dilemma, what exactly the problem. Can someone please help.

    For me, there's a code unepxected in your touchEvent() - getFieldAtLocation().  If you want released supporess presses of field, I suggest you use code like this:

    protected boolean touchEvent (TouchEvent message) {}

    int x = message.getX (1);
    int y = message.getY (1);
    If (x < 0="" ||="" y=""> < 0="" ||="" x=""> getExtent () .width: y > getExtent () .height) {}
    Outside the scope
    Returns false;
    }

  • custom bitmaps field not change image when click on

    I created a custom bitmap field and I change the image on the center of my field of custom bitmaps and unfocus

    but when I implement the method of navigation click to change the image when you click on this image does not change...

    my custom bitmap field filed only to focus or unfocus on the image does not change my field of custom bitmaps.

    Bitmap onfocus = Bitmap.getBitmapResource("111.png");
                    Bitmap onunfocus = Bitmap.getBitmapResource("666.png");
                    mybutton1 = new CustomBitmapField(0,"",onunfocus,onfocus,Field.FOCUSABLE){
                         protected boolean navigationClick(int status, int time) {
    
                             mybutton1.setBitmap(Bitmap.getBitmapResource("favu.png"));
    
                             return true;
    
                         }
    
                    };
    add(mybutton1);
    

    and my class of field customBitmap is

    public class CustomBitmapField extends BitmapField {
    
        Bitmap Unfocus_img, Focus_img, current_pic;
        int width;
        String text;
        Font font; 
    
        public CustomBitmapField(int width, String text, Bitmap onFocus, Bitmap onUnfocus, long style) {
            // TODO Auto-generated constructor stub
            super();
            Unfocus_img = onUnfocus;
            Focus_img = onFocus;
            current_pic = onFocus;
            this.text = text;
            this.width = width;
    
        }
        protected void layout(int width, int height)
        {
            setExtent(current_pic.getWidth(), current_pic.getHeight());
        }
        protected void paint(Graphics graphics)
        {
            /*try
            {
                    FontFamily fntFamily = FontFamily.forName("BBAlpha Sans");
                    font = fntFamily.getFont(Font.BOLD,14);
            }
            catch(Exception e)
            {
                font = Font.getDefault();
    
            }
            graphics.setFont(font);
            graphics.setColor(Color.WHITE); */
            graphics.drawBitmap(0, 0, current_pic.getWidth(), current_pic.getHeight(), current_pic, 0, 0);
    
            //graphics.drawText(text, width, 7);
        }
        protected void onFocus(int direction)
        {
            super.onFocus(direction);
            current_pic = Unfocus_img;
    
            this.invalidate();
        }
      protected void drawFocus(Graphics graphics, boolean on)
      {
    
        }
        protected void onUnfocus()
        {
            super.onUnfocus();
            current_pic = Focus_img;
            invalidate();
        }
        public boolean isFocusable() {
            return true;
        }
        protected boolean navigationClick(int status, int time) {
    
            fieldChangeNotify(0);
            return true;
        }
    
    }
    

    When you debug this code, which of your methods of navigationClick, is actually used?

    When you expect the bitmap change, the code should lead object so that to happen.  Paint running?  This is the correct Bitmap painting?

    If you answer these questions, I think that you figure to yourself what is the problem.

    While you're there, you can also watch the following Threads that you have started or contributed to.  Can you solve or continue to contribute to these?

    http://supportforums.BlackBerry.com/T5/Java-development/gif-animation-not-displaying-properlly/m-p/2...

    http://supportforums.BlackBerry.com/T5/Java-development/timepicker-issue/m-p/2387819

    http://supportforums.BlackBerry.com/T5/Java-development/ListField-focus-color-problem/m-p/2407881#m2...

  • Custom image drop-down list appears not appropriate on Blackberry 9000 Simulator

    Hello

    I created the custom in my code drop-down list. my code works fine for other simulators.

    But when I tried to run on Blackberry 9000 Simulator from the drop-down list not shown correct image he cuts half the size of the image.

    I check my code, I did not manually height for the drop-down list.

    Please tell me why image appears not appropriate Simulator 9000.

    Welcome to the forums.

    I'm guessing that you don't know how to use the insert of Code button.  If you look at the top of the editing window, you will see a number of options for formatting such as police.  Look to the right and there are two buttons, one is used to insert the code.  Hover over the buttons and you will see a description.  Press the button insert the Code, add your code and you will see something like the following:

        public void drawListRow(ListField list, Graphics g, int index, int y, int w) {
            Bitmap bitmap = Bitmap.getBitmapResource(arrowBitmapName);
            int fontWidth = getFont().getAdvance(text);
            int width = Display.getWidth() ;
            int height = list.getRowHeight();
            g.setColor(Color.BLACK); g.setFont(fontPlain);
            g.drawBitmap(0,0, bitmap.getWidth(), bitmap.getHeight(), bitmap, 0, 0);
            g.drawText(text, 3, y-drptextHeight, 0, w);
        }
    

    I think it's the routine that you use to draw each line of your drop...

    I recommend that move you as much code as you can out of this method.  It's called very often.  Creating a Butmap here, which is an expensive operation, is not a good idea, especially when the Bitmap image in reality does not change.  So create once and use it in the drawListRow.

    Also use the parameters that are passed.  The width you have to paint is given in the parameter, and perhaps not the same as the actual display width.

    In any case, this code draws the Bitmap to (0, 0).  I susspect should be at (0, y).  This could explain why it is not drawn correctly.  You seem to have a similar problem with the text.

    The drawListRow is assigned a value of 'y' and should paint from y to y + listField.getRowHeight ().  But in fact drawListRow has access to the area of the entire painting, so can do too much else.  You must code your method correctly to get good results in your list.

    Hope this helps, if not, please post your code so we can actually read.  In fact, as I say to others, do not post your real code.  Create a simple example that we can run illustrating your problem.  Then everything can run your example and see the problem.  Never stick all your code.  People are put off by the number of lines of code.

Maybe you are looking for