Hi,
I’m not sure if this post should be in the newless cluebies section, but here goes.
I have read (and, I think, understood) the whole article on “Painting in AWT and Swing” at http://java.sun.com/products/jfc/tsc/articles/painting/index.html
I am writing an app that needs to draw a graph (a mathematical one - nodes, edges etc). The graph will be changing rapidly so the drawing needs to be animated. I plan on using Java2D for this.
I was just wondering if someone could post a basic class structure for doing this. i.e. Should I extend JPanel or Component? Should I use paintImmediately() or will repaint() suffice?
Also how should I thread the actual algorithm that manipulates the graph so that when the algorithm is running, the GUI can still be used. Should I put the algorithm in its own class implementing Runnable?
Any design patterns that you guys commonly use? e.g. Model, View, Controller?
Thanks.