See below...
" Thank you for your answer.
But I am originally using an Applet. My Panel was put on the surface of
the Applet.
Now how can I put the Canvas on the Applet instead of the Panel. The
Canvas is not one of the components that can be created by (Darg-Drop).
I am using Exclipse software from IBM. I checked the components window,
there is no canvas to (drag-drop) over the Applet face, as it is the
case with the Panel.
Thanks "
Please post your replies underneath rather than on top. Posting at the
top is (unsurprisingly) known as 'top-posting' and is frowned upon
because it makes it more difficult to see context as you read from top
to bottom.
Why not add the canvas to your panel?
Set your panel's layout manager to 'BorderLayout', and add the canvas
using BorderLayout.CENTER. To do this... first go the constructor of
your panel and make sure the constructor says...
Panel panel = new Panel(new BorderLayout());
....you can probably do this by setting the layout manager using eclipse,
I wouldn't know
Now you can create your canvas instance and add it to the panel...
Canvas canvas = new DrawingCanvas();
panel.add(canvas, BorderLayout.CENTER);
....and there you go.
If you are confused on how to do this kind of GUI creation in code
rather than through eclipse, you have just discovered why it is a bad
idea to learn Swing/AWT development with GUI editing tools. With the
kind of code you are writing you will not be able to do everything
through eclipse so it is time to get your hands dirty and learn what is
really going on. You will be a much better developer for it.
I happen to use a GUI editing tool for any Swing GUIs I write (with is
rare nowdays), but because I know I can open the code and do it by hand
if the shit hits the fan, for me a GUI editor is a tool rather than a
crutch.
Break away, break free, and rise above all those VB monkeys

P