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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Highlighted
Developer
Posts: 57
Registered: ‎05-25-2009
My Device: Not Specified

ButtonField background clolor problem

I want to make a buttonField on Curve 8300 phone like the picuture below shows ;

button

 

And  the my code is :

 

 

ButtonField_submit = new ButtonField("Login", ButtonField.CONSUME_CLICK) { protected void layout(int width, int height) { setExtent(60, 20); } protected void paint(Graphics graphics) {

graphics.setBackgroundColor(0x7F000000);

graphics.clear();

graphics.setFont(f1); graphics.setColor(Color.WHITE); graphics.setDrawingStyle(DrawStyle.HCENTER, true); super.paint(graphics); } };

 

But the code above fails to make the button like the picture goes.

 

 

My quesition is how to write the paint fucntion to make the button show the blackground like the picture?  Thanks.

 

 

Developer
Posts: 293
Registered: ‎02-25-2009
My Device: Not Specified

Re: ButtonField background clolor problem

ButtonField_submit = new ButtonField("Login", ButtonField.CONSUME_CLICK) {
protected void layout(int width, int height) {
setExtent(60, 20);
}

protected void paintBackground(Graphics graphics) {

graphics.setColor(0x7F000000);


super.paintBackground(graphics);



}
};

 

please check does this code help you or not ?

Developer
Posts: 984
Registered: ‎02-10-2009
My Device: Not Specified

Re: ButtonField background clolor problem

Also chek the custombuttons sample shipped with the JDE.

And also have a look at this CustomButtonField example.

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=37909#M37909

 

Regards

Bikas

Developer
Posts: 57
Registered: ‎05-25-2009
My Device: Not Specified

Re: ButtonField background clolor problem

thanks,but the method fails to work