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
Posts: 415
Registered: ‎07-28-2010
My Device: 8000
My Carrier: hi

problem with bitmap

hello friends,

                      i have one problem in which i want to show editfield on image but when i set image as bagroud in paint method than how we show edit field on that image?

please help me friends,

thanks and regards 

 ajay patil.

Developer
Posts: 209
Registered: ‎04-30-2011
My Device: BlackBerry Z10
My Carrier: Airtel

Re: problem with bitmap

Hello Dear,

 

Do one thing, 

 

First add image in background of Verticalfield manager. and then add that editField on Verticalfield manager.

 

 

Like:

 

VeriticalFieldmanager v = new VeriticalFieldmanager();

v.setBackground(BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("img/topbar_buddylist.png")));

 

then

 

EditField e = new EditField("Type here","");

 

v.add(e);

 

add(v);

Developer
Posts: 415
Registered: ‎07-28-2010
My Device: 8000
My Carrier: hi

Re: problem with bitmap

thanks for replying me.
that is not work for me. means i want one background image. on that one image of red color as edit field and i want to put edit field on that.
how shuld i do that?
Developer
Posts: 253
Registered: ‎08-14-2010
My Device: Not Specified

Re: problem with bitmap

can u please add a design image , I can not understand your last post

Developer
Posts: 209
Registered: ‎04-30-2011
My Device: BlackBerry Z10
My Carrier: Airtel

Re: problem with bitmap

Hi,

 

if u want to set image in backgroud of Screen then, use 

 

this.getMainManager().setBackground(BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("Login_page.png")));

 

in construction, then follow my last reply.

 

or 

 

if you think that, you will add image in background, then add  image on that background, 

 

follow my earlier reply with some chaing

verticalfield.add(new BitmapField(Bitmap.getBitmapResource("Login_page.png")))

 

And, now if you want to add editfield on Login_page.png, then According to me, it is not possible.

 

Becuase, we cannot add field over field. you can add field on Managerfield only..............

Developer
Posts: 253
Registered: ‎08-14-2010
My Device: Not Specified

Re: problem with bitmap

public class CustomEditField extends BasicEditField {
	
	Bitmap b ;
	public CustomEditField() {
		// TODO Auto-generated constructor stub
		
		b= Bitmap.getBitmapResource("background.png");
		
		
	}
	
	 protected void paint(Graphics graphics) {
		// TODO Auto-generated method stub
		
		
	  graphics.drawBitmap(0, 0,getWidth()	, getHeight()	, b, 0, 0);
		
		
		super.paint(graphics);
	}

	

}

 

Developer
Posts: 209
Registered: ‎04-30-2011
My Device: BlackBerry Z10
My Carrier: Airtel

Re: problem with bitmap

Hi,
Do one thing, take an image inside res/img/"image.png"
OK, then, Call addimg class from any class


class addimg extends MainScreen{
EditField e;
VeriticalFieldmanager v;
public addimg()
{
v = new VeriticalFieldmanager();
v.setBackground(BackgroundFactory.createBitmapBackground(Bitmap.getBitmapResource("img/image.png")));

e = new EditField("Type here","");v.add(e);add(v);

}

}