how to write a derived class from game.Layer?

hi
i try to write a derived class of game.Layer , just like
Sprite or tiledLayer, so , i implement a paint() method.
but some problem appear:
code :
class testlayer extends Layer{
public paint(Graphics g){}
}

help me ,pls.

What’s the error message?

I’ve not written any J2ME, but I guess you’re missing a “void” in there:

class testlayer extends Layer{ 
  public void paint(Graphics g){} 
}

thanks to your reply

=============
no , i did write a paint() method like this:
class tlayer extends Layer{
tlayer(){super();}
public void paint(Graphics g){}
}
and the error message is
can’t resolve symbol :
Layer()

i think some problem occurs on constructor function,
but , i can’t find some documention about layer’s
constructor function in MIDP doc.

can u tell me how to get the layer's constructor function declaration?

thx

is there a noarg. constructor in the Layer class?

your error msg implies there isn’t.

i think there is no arg constructor method too.
But i can’t find layer’s constructor in MIDP api doc .
so , i discard this idea…

anyway, thanks to guys above .

Sadly, there is no way to write a derived class from Layer, which i have tried before.

I have downloaded the source file of MIDP from Sun, to see how to write the constructor of Sprite. From the constructor of Sprite, I found the constructor for Layer, which takes two parameters (int width, int height).

Then, i switched to the source code of Layer to see the details, the constructor there is declared as default, and there is a comment that declaring as default is to prevent developers from subclassing this class - Layer.

Since there is no way for me to declare my class to be in the same package as Layer, there is no way to sub-class Layer.

If anyone know any tricks to sub-class Layer, please tell me also!

Ya it’s messy that we can’t subclass Layer class.
In fact The only solution is to rewrite a more powerfull LayerManager that accept ExtraLayer and derived basic Layer.

Duuh

Mik