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
kungfucop
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.

 

 

Please use plain text.
Developer
amardeepjaiman
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 ?

Please use plain text.
Developer
bikas
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

Please use plain text.
Developer
kungfucop
Posts: 57
Registered: ‎05-25-2009
My Device: Not Specified

Re: ButtonField background clolor problem

thanks,but the method fails to work
Please use plain text.