views:

54

answers:

1

I am creating five EditFields with corresponding label fields. The EditFields use the full width of the screen but I need only want them to use a particular width.

A: 

try this code:-

BasicEditField bef = new BasicEditField("BBDeveloper","")
    {
        public int getPreferredHeight() 
        {
            return 30;
        }

        public int getPreferredWidth() 
        {
            return 100;
        }

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

alter the getPreferredWidth() and getpreferredHeight() returning values... and see if this help you out....

rupesh
thank u very much,it works fine...but it did n't reduce height of the edit field..it reduce only width can u pls suggest how can i reduce height also
MaheshBabu