Java : Convert a awt.Canvas to a container?
I have a base class Company_1_Canvas
and another Company_2_Canvas
.
I would like to put the Company_2_Canvas
into the Company_1_Canvas
.
In fact my first canvas should act as a container and not a canvas.
Do you have any idea to do this ?
Remarks : it is a little bit complex to explain why I need this (Design is not wonderfull I know) ! Sorry !
I have try to redefine the 'paint' method of the first canvas, but then the second canvas has NO 'g开发者_JS百科raphics' object because it is not part of the controls hierarchy !
Notice that both canvas have C++ native methods that are playing with the canvas, so I cannot change this !
Optimal solution is to redesign and get away from this mess and Canvas
completely.
Possible workaround would be to have Canvas1 pass a Graphics
object to Canvas2 to have it draw on Canvas1.
精彩评论