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
Trusted Contributor
Posts: 138
Registered: ‎04-19-2012
My Device: No
My Carrier: Nokia

How to add Square box with color without hard Coded.

I am try to create a custom list with Label and square box with color. I am able to having a Label in my list but not square . 

 

How can i add this .

Developer
Posts: 354
Registered: ‎06-05-2013
My Device: Blackberry Z10
My Carrier: Vodafone

Re: How to add Square box with color without hard Coded.

can we see snapshots of screen you wanted?
Trusted Contributor
Posts: 138
Registered: ‎04-19-2012
My Device: No
My Carrier: Nokia

Re: How to add Square box with color without hard Coded.

Aman there is no specific design for that .

 

 

Label                                         [  ]

Label                                         [  ]

 

like this. these are square boxs

Developer
Posts: 354
Registered: ‎06-05-2013
My Device: Blackberry Z10
My Carrier: Vodafone

Re: How to add Square box with color without hard Coded.

So you want something like buttons i.e for square brackets
you can say square buttons you want to create
Trusted Contributor
Posts: 138
Registered: ‎04-19-2012
My Device: No
My Carrier: Nokia

Re: How to add Square box with color without hard Coded.

can we not do this thing if i make 3 character whitespace in label.setText("    "); and set the color in that . so will it look like square or rect.

Developer
Posts: 354
Registered: ‎06-05-2013
My Device: Blackberry Z10
My Carrier: Vodafone

Re: How to add Square box with color without hard Coded.

Try this code:

 

HorizontalFieldManager horizontalFieldManager = new HorizontalFieldManager()
        {
            protected void setExtent(int width, int height)
            {
                super.setExtent(75, 50);
            }
        };
        horizontalFieldManager.setBackground(BackgroundFactory.createSolidBackground(Color.RED));
        LabelField labelField = new LabelField();
        horizontalFieldManager.add(labelField);
        add(horizontalFieldManager);


hope this is what u want?

 

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

Re: How to add Square box with color without hard Coded.

[ Edited ]

What is the purpose of this 'square'?  Is it just a square on the screen or does the user interact with it?