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

Posts: 214
Registered: ‎03-18-2012
My Device: 8520
My Carrier: Company
Accepted Solution

problem Border is not Displaying on RightSide


       I am creating two LabelField label1 and label2 and then i added border to both of them...and then i added

       thesefields to   HorizontalFieldManager...


Problem is that when i use layout methode in LabelField (label1) then border on the Rightside of the LableField(label2) is not displaying...


LabelField label1=new LabelField("    IMEI           ")
              protected void paint(Graphics g)
              protected void layout(int width,int height)
                  super.layout(width, height);
                  setMargin(new XYEdges(0,0,0,50));                  
label1.setBorder(BorderFactory.createBevelBorder(new XYEdges(2,0,2,2)));


 LabelField label2=new LabelField("   dasd        ");

        label2.setBorder(BorderFactory.createBevelBorder(new XYEdges(2,2,2,2)));


 HorizontalFieldManager hfm=new HorizontalFieldManager();

Posts: 19,618
Registered: ‎07-14-2008
My Device: Not Specified

Re: problem Border is not Displaying on RightSide

I'm not sure what is wrong, but you must move this:

setMargin(new XYEdges(0,0,0,50));

out of the layout.  The framework calls layout when it wants to know how much space to allocate to the device.  You have to have set the Margin before then.


So take it out of there and do a


like you set the Border. 


I note that your two BorderFactory calls are slightly different.  Is that deliberate?