java - If you pass another object a current object's Graphics2D, would it paint on the current object? -
for example have class extends jpanel, , want pass it's graphics2d class b. if operations on graphics2d instance in class b paint on class a?
public void paintcomponent(graphics g){ super.paintcomponent(g); graphics2d g2d = (graphics2d)g; ... b.dosomepainting(g2d); ... }
yes. make think otherwise? you're doing delegating painting of graphics2d
object of class a
class b
. it's simple.
Comments
Post a Comment