标签: java dynamic polymorphism mouseevent shapes
例如 我创建了一个抽象类Shape,并创建了3个子类Circle,Rect,square,line,RoundRect
然后我将方法应用于所有子类
然后,我必须在鼠标事件之前调用抽象类。我必须在JFrame中拖动鼠标来绘制形状。
例如:-
Shape s; Mouse Event s= new Circle() g.drawOval(0,0,this.getWidth(),this.getHeight());// its not accepting