(keitai-l) Re: Creating new DoJa UI Components

From: Sam Joseph <gaijin_at_yha.att.ne.jp>
Date: 09/18/03
Message-ID: <3F69863A.80900@yha.att.ne.jp>
Jason Pollard wrote:

>  
>
>>Well the thing is that I just started off trying to create a Gauge that 
>>was a modified Label - having been unable to extend either Label or 
>>Component, I created a Gauge class that included a Label inside it.
>>    
>>
>
>You can't extend the Component abstract class?  
>
Well you can - but you can't override the paint method, which I think is 
what gets called to actually draw the component - if you don't override 
the paint method, then the Component default paint methods get used - 
and in the emulator at least, nothing gets drawn

>That would be the way to go if
>you could.  Something like at the bottom.  If the gauge was a Component, you
>could put it in your toolbox and use it anywhere you'd use another component. 
>For example, you could:
>aPanel.add(gauge)
>
>This example isn't the best if code size is a problem for you.  But extending
>Component would be more object oriented and reusable.
>
I just tried out your suggestion, which was a good one.  The getWidth() 
and getHeight() methods are final so they can't be overidden, so I left 
those out. But I implemented all the others as you suggested, and added 
the gauge as a component, but nothing gets drawn - when I run it in the 
emulator that is.

I agree this would be more OO and re-usable, but as is sometimes the 
case with these things it seems it doesn't actually produce a working 
GUI component   It may be that there are additional changes that might 
make this approach work on the emulator and phone, but I think the 
inability to overide the components paint method is the real sticking 
point ...

CHEERS> SAM

p.s. thanks for all your input on this if I didn't thank you already
Received on Thu Sep 18 13:16:28 2003