例如,我有扩展JPanel的类A,并且我想将它的Graphics2D传递给类B.如果我在类B的Graphics2D实例上执行操作,它会在类A上绘制吗?如果您将另一个对象传递给当前对象的Graphics2D,它会绘制当前对象吗?
public void paintComponent(Graphics g){
super.paintComponent(g);
Graphics2D g2d = (Graphics2D)g;
...
b.doSomePainting(g2d);
...
}
在这里失踪reall问题1)你想克隆自定义绘画从B - > A,2)你想通过绘画从B - > A,3)另一个东西, – mKorbel
我有我的面板(A)和我想分割A的功能,以便B完成所有的动画,但仍然绘制到A上。如果这有意义? – rtheunissen
http://sites.google.com/site/drjohnbmatthews/kineticmodel/code by @trashgod,有很多模型 - >控制器 - >视图(MVC)的例子,但这是最好的,因为我在几个上个月 – mKorbel