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
Developer
SumiGhosh
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380

How to get this design in my application

Hi all,

Im new to Blackberry java, worked on core java and android. What i need is to get the UI as shown in the image, i checked and coded but not able to achieve the correct design as shown in the image. So, can any one  explain me how to do this. Untitled.png

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: How to get this design in my application

a labelfield, an editfield with a border set, and both in a horizontalfieldmanager.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
SumiGhosh
Posts: 435
Registered: ‎09-20-2011
My Device: Z10 LE, Playbook, DevAlpha C, 9900, 9380

Re: How to get this design in my application

Thank you simon, im able to achieve partially, when i set background for the EditText i'm not able to see the border.  

Developer
arkadyz
Posts: 2,268
Registered: ‎07-08-2009
My Device: various

Re: How to get this design in my application

There is an article in the knowledge base addressing this specific design:

Scrollable one-line text input field

The code you are looking for is actually in the comments section. However, I recommend you read the whole article - as an experienced Java programmer, you should have no trouble understanding the concept and tailoring it to your needs. The comments address the border requirement.

----------------------------------------------------------
please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!
Developer
pankajace12
Posts: 206
Registered: ‎04-30-2011
My Device: BlackBerry Z10

Re: How to get this design in my application

Hi SumiGhosh

 

Try this code.

 

import net.rim.device.api.ui.XYEdges;
import net.rim.device.api.ui.component.EditField;
import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.HorizontalFieldManager;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.decor.BorderFactory;

public class pkj extends MainScreen{
public pkj() {
	// TODO Auto-generated constructor stub
	HorizontalFieldManager hfm = new HorizontalFieldManager();
	
	LabelField lbl = new LabelField("Company: ");
	EditField _editField = new EditField();
	_editField.setBorder(BorderFactory.createBevelBorder(new XYEdges(2,2,2,2)));
	hfm.add(lbl);
	hfm.add(_editField);
	add(hfm);
}
}

 

Thanks

Developer
lakshman9687
Posts: 243
Registered: ‎07-22-2011
My Device: BlackBerry Z10

Re: How to get this design in my application

Hi,

 

You want to put that image as background the override the getPreferredWidth() and getPreferredHeight() methods in editField and return according to that image size then u can get the image like that.

 

Regards,

Lakshman K

----------------------------------------------------------
Feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.