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: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550
My Carrier: Airtel

can i set editfield on bitmap?

hi all,

        i'm havig a bitmap as 1816iCDB4EAD95A8B14DC   on it can i set the edit field and if yes how to set its postion on it. also the focus.

Swapnil G.
New Contributor
Posts: 7
Registered: ‎04-07-2010
My Device: Blackberry 9000
My Carrier: China Mobile

Re: can i set editfield on bitmap?

You can create a custom manager and paint that bitmap as background. And add the edit field to that manager. And you can set the position of the edit field in the manager's sublayout method. Focus should be take cared by the manager automatically.

Trusted Contributor
Posts: 200
Registered: ‎02-22-2010
My Device: BlackBerry 9550
My Carrier: Airtel

Re: can i set editfield on bitmap?

any code if anybody can give wuld be more helpful to understand??

Swapnil G.
Highlighted
New Contributor
Posts: 7
Registered: ‎04-07-2010
My Device: Blackberry 9000
My Carrier: China Mobile

Re: can i set editfield on bitmap?

 

public class TextBoxField extends Manager {

	private EditField editField;

	public TextBoxField(long style, EditField editField) {
		super(style);
		this.editField = editField;
		add(editField);
	}

	protected void sublayout(int width, int height) {
		layoutChild(editField, width - 10, height);
		setPositionChild(editField, 5, 5);
		setExtent(editField.getWidth() + 10, editField.getHeight() + 10);
	}

	protected void paintBackground(Graphics g) {
		g.setBackgroundColor(Color.WHITE);
		g.clear();
		g.setColor(Color.BLACK);
		g.drawRoundRect(0, 0, getWidth(), getHeight(), 15, 15);
	}

}