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
Regular Contributor
VimalSandy
Posts: 97
Registered: ‎07-12-2011
My Device: curve 8900

Image Checkbox field

hi.. i want create Image check box field.. first checkbox then Image and one string.. how to do that.. help me out

Please use plain text.
Developer
alishaik786
Posts: 285
Registered: ‎08-26-2011
My Device: 9900

Re: Image Checkbox field

This code helps you: 

 

public class Jkl extends MainScreen
{
	CheckboxField checkboxField;	
	public Jkl() 
	{
		createGUI();
	}

	private void createGUI() 
	{
		HorizontalFieldManager hr=new HorizontalFieldManager(USE_ALL_WIDTH);
		
		checkboxField=new CheckboxField("",false);
		checkboxField.setPadding(0, 10, 0, 10);
		hr.add(checkboxField);
		
		hr.add(new BitmapField(Bitmap.getBitmapResource("noimage.png")));
		
		hr.add(new LabelField("Image Not Find",Field.FOCUSABLE));
		
		add(hr);
	}
}

Then I got lik this below Image;

 

abcdefg.png

 

 =======================================================================

Feel free to click LIKE button

=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.
Regular Contributor
VimalSandy
Posts: 97
Registered: ‎07-12-2011
My Device: curve 8900

Re: Image Checkbox field

its not working
Please use plain text.
Developer
alishaik786
Posts: 285
Registered: ‎08-26-2011
My Device: 9900

Re: Image Checkbox field

What is not working......?
=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.
Regular Contributor
VimalSandy
Posts: 97
Registered: ‎07-12-2011
My Device: curve 8900

Re: Image Checkbox field

if add checkbox,image,label.. its displaying only checkbox.. not all
Please use plain text.
Regular Contributor
GaneshPachpind
Posts: 67
Registered: ‎08-16-2011
My Device: 7185

Re: Image Checkbox field

Because checkbox use complete width of the screen

you have to use override ckeckbox sublayout method and  

 

   setExtent(10,height);  // this will creat checkbox of width 10 and default height

 

 

:smileyhappy:

 

Please use plain text.
Regular Contributor
VimalSandy
Posts: 97
Registered: ‎07-12-2011
My Device: curve 8900

Re: Image Checkbox field

For Checkbox Field no sublayout option.. its only Having Layout..
and also ur method not working.. its display only checkbox...
Please use plain text.
Developer
alishaik786
Posts: 285
Registered: ‎08-26-2011
My Device: 9900

Re: Image Checkbox field

[ Edited ]

Try this code you can under everything:

 

private void createGUI() 
{
	// If you want the field side by side you must take HorizontalFieldManager
		
	HorizontalFieldManager hr=new HorizontalFieldManager(USE_ALL_WIDTH);
	CheckboxField checkOne=new CheckboxField("Remember my Password", false)
	{
		protected void layout(int width, int height) 
		{
			super.layout(300,50);
			setExtent(300,50);
		}
	};
	hr.add(checkOne);
	hr.add(new LabelField(" Hello"));
	add(hr);
	
	HorizontalFieldManager hr1=new HorizontalFieldManager(USE_ALL_WIDTH);
	CheckboxField chcekTwo=new CheckboxField("", false)//If you are not take any label here;
	{
		// No need to write layout method;
	};		
	hr1.add(chcekTwo);
	hr1.add(new LabelField(" Remember My Password"));
	add(hr1);
}	

 ==================================================================================

 

Feel free to click LIKE button if the solution is correct;

=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.
Regular Contributor
VimalSandy
Posts: 97
Registered: ‎07-12-2011
My Device: curve 8900

Re: Image Checkbox field

Thanks dude.. I got solution.. to extends Checkbox field.. i draw checkbox,image and text too...
Please use plain text.