Welcome!

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

Reply
Contributor
Posts: 35
Registered: ‎02-02-2012
My Device: 9300
My Carrier: Vodafone
Accepted Solution

How to add an empty line

Hi,

I know it's very basic what I'm asking, but I'm getting crazy trying to find it.

I want to draw an empty line between to LabelFieds.

Somethin like:

 

label1

 

label2.

 

I know there is a function which does that, but I can't remember it and I'm not able to find it in google.

 

Thanks!

 

Developer
Posts: 226
Registered: ‎10-01-2011
My Device: Passport

Re: How to add an empty line

vfm.add(new SeparatorField(Field.NON_FOCUSABLE));

 

 

Regular Contributor
Posts: 77
Registered: ‎05-21-2012
My Device: 9900

Re: How to add an empty line

I really appreciate that even the smallest of the smallest doubts are paid here here. :smileyhappy:

 

I too suffer from the same problem.

 

I trid the above code in my hfm but its distorting my display.

 

Request crispyoz to please solve my problem as well

 

I have a labelfield called Name: and beside that i want to have a box which is the editfield.

 

But what i get is this

 

                                                    [Box of editfield]

               Name:

 

As you can see its not in the same line.This is my code.Please help.

 

                     

HorizontalFieldManager hfm = new HorizontalFieldManager();
       LabelField lbl = new LabelField("\n Name:                  ");
       
       final EditField TextField1 = new EditField()
       {
           
            protected void layout(int maxWidth, int maxHeight) 
            {
                super.layout(Math.min(maxWidth, 300), Math.min(maxHeight, 20));
            }
           protected boolean keyChar(char ch, int status, int time) 
                {
                if (CharacterUtilities.isLetter(ch) || (ch == Characters.BACKSPACE || (ch == Characters.SPACE))) 
                {
                return super.keyChar(ch, status, time);
                }
               return true;
                }
                
        };
       TextField1.setBorder(BorderFactory.createRoundedBorder(new XYEdges(5,5,5,5)));
       hfm.add(lbl);
       //hfm.add(new SeparatorField(Field.NON_FOCUSABLE));
       hfm.add(TextField1);
       add(hfm);

 Thanks.

Regular Contributor
Posts: 77
Registered: ‎05-21-2012
My Device: 9900

Re: How to add an empty line

I have used \n in name.I dont want to remove that as on removing it may be in line with box but there wont be space between this name field and the previous field.
Developer
Posts: 226
Registered: ‎10-01-2011
My Device: Passport

Re: How to add an empty line

your label field contains "\n Name"  the "\n"  is a new line so of course it will move down a line. 

 

Also you should not answer on a solved issue, you should start a new thread.

 

Regular Contributor
Posts: 77
Registered: ‎05-21-2012
My Device: 9900

Re: How to add an empty line

Yes is there any way i can push down the editfield as well. Apologies for reposting here.Next time i'll sure start a new thread.Thanks.
Regular Contributor
Posts: 77
Registered: ‎05-21-2012
My Device: 9900

Re: How to add an empty line

The issue has been resolved.:smileyhappy: I used an empty labelfield to add space between the 2 fields.Works fine