I'm using paintComponent within a class that extends Jcomponent (using Java2 1.4.2). I'm using graphics2D by:
public void paintComponent(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
...
I can access all the advertised methods from there. However, I need to build some compound objects with common structure, but vary the characteristics of elements within the objects, for example, different colors, linetypes, rotations, etc. I know how to use GeneralPath, Area, intersect, add, etc. to manipulate these elements, but I need to create many of these compound objects with the flexibility of making the separate elements within the objects look different as needed. The first thing I think of is to build methods with arguments for what I want to vary. However, within those methods I cannot use the methods that manipulate the graphics object, apparently, and I that isn't thinking the OO way, methinks.
Is the use of an inner class advised here? I know that gives me access to data and instances of the surrounding class. Or is it better to use an external class, and if so, can I pass a reference to be able to access the graphics object? I'm not quite sure how to go about this and haven't been able to find examples of it.
Yes, I have taken intro classes in OOA and OOD, and an intro
Java class, but it doesn�t all stick at once. ;-)
Thanks for any help you can offer.