Search This Blog

Monday, 26 March 2012

How to change size of fields and Managers..

Hello friends, Here is the simple one for you , how to change the width and height of any field in Blackberry development.... you just need to over ride the sublayout function for managers, and layout function for fields...
 Code :
 For Managers(HorizontalFieldManager):

public int getPreferredWidth(){
                return Display.getWidth();
            }
            public int getPreferredHeight(){
            return _speedB.getHeight()+5;
            }
            public void sublayout(int maxWidth,int maxHeight){
                super.sublayout(getPreferredWidth(), getPreferredHeight());
                setExtent(getPreferredWidth(),getPreferredHeight());
            }


 For Fields(RichTextField):


 RichTextField _vehicle = new RichTextField(ListOfVehicles._resultName.toUpperCase()){
 public int getPreferredWidth(){
 return 100;
 }
 public int getPreferredHeight(){
 return 50;
}
 public void layout(int maxWidth,int maxHeight){
 super.layout(getPreferredWidth(), getPreferredHeight()); setExtent(getPreferredWidth(),getPreferredHeight());
}

No comments:

Post a Comment