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
Posts: 75
Registered: ‎07-22-2010
My Device: Not Specified
My Carrier: Trainee
Accepted Solution

GaugeField Query

How can I change the default color of gaugeField.

In default,  gaugeField color is blue. How can I make this color yellow. ?

 

If I override the paint method of gaugeField like this:

 

 

 

 protected void paint(Graphics graphics)

{

 

}

The gaugeField can not be seen. Its colors become transparent.

 

if I do :

protected void paint(Graphics graphics)

{

   graphics.setBackgroundColor(Color.YELLOW);

 

}

It doesn't work .... It looks like default.

Developer
Posts: 79
Registered: ‎09-15-2008
My Device: Not Specified

Re: GaugeField Query

Hi,

 

Were you able to make it work?

I am looking for the same.

 

 

protected void paint (Graphics g)
{
System.out.println("Progress Bar Paint method");
g.setBackgroundColor(Color.YELLOW);
g.setColor(Color.YELLOW);
super.paint(g);
}

 

 

 

I want the default progress bar color Blue to some thing different, how to achieve that?

 

Thanks

Alkesh

Regular Contributor
Posts: 75
Registered: ‎07-22-2010
My Device: Not Specified
My Carrier: Trainee

Re: GaugeField Query

this might be a solution.

 

 

protected void paint (Graphics g)
     {
          g.setColor(Color.YELLOW);
          g.fillRect(0,0,(gauge.getValue()*2),15);
    }

 

 

  Do not write --------->      super.paint(g);

 

 

Highlighted
New Contributor
Posts: 2
Registered: ‎08-19-2011
My Device: 8520
My Carrier: Tim

Re: GaugeField Query


protected void paint(Graphics g)

{

        //super.paint(g);
        int contentWidth = this.getContentWidth();

        int size = (this.getValue() * contentWidth) / this.getValueMax();

        g.fillRect(0, 0, contentWidth, this.getContentHeight()); 

}