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
New Contributor
Posts: 2
Registered: ‎07-06-2011
My Device: 600
My Carrier: postal

Making a simple thermometer work

Hallo 

I'm a novice at this. My problem is that I want to make a thermometer

witch consists of a seethrough pane with the  thermometerimage gif,

and behind this a red rectangle that can grow to the desired level(themperature)

slowly. (without blocking the view on the height indication stripes on the thermometer)

Can anybody help me please?!

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Making a simple thermometer work

I suspect the best way to do this is to use BitmapField and add to this Field an image of a Thermometer that you paint over the top off.  Have the 'red bit' transparent as you suggest.

 

Once you have this working, then you need to override the paint method in this field,  You want to use fillRect to paint over a proportion of the Bitmap with red color, and then call super,paint to paint the thermometer (or you could do it yourself using <graphics>drawBitmap(...);

 

The trick is going to be to figure out how to paint the red rectangle to an appropriate size and that will depend on the thermometer.

 

So the keys are

a) BitmapField

b) override paint.

 

Good luck.

New Contributor
Posts: 2
Registered: ‎07-06-2011
My Device: 600
My Carrier: postal

Re: Making a simple thermometer work

Hi Peter

 

Thanks for you quick answer tomorrow i'll try it out tomorrow!

Bye Hans