[I sent this earlier, but it doesn't appear to have gone anywhere so I
am resending it in hopes that it makes it through to the forum and
mailing list to clarify things.  Apologies if this causes duplicate
messages for some...jim]

That translates the device space 100 pixels over. Great. But the next time I 
invoke paint, the device space is back to 0,0, as if I never told the graphics 
to move over 100 pixels.

The documentation for the Component.paint(Graphics g) method:

<http://java.sun.com/javase/6/docs/api/java/awt/Component.html#paint(java.awt.Graphics)>

has a pointer to a technical article which describes the paint model in
detail:

<http://java.sun.com/products/jfc/tsc/articles/painting/>

It includes the following text:

    When AWT invokes this method, the Graphics object parameter
    is pre-configured with the appropriate state for drawing on
    this particular component:

    * The Graphics object's color is set to the component's
      foreground property.
    * The Graphics object's font is set to the component's
      font property.
    * The Graphics object's translation is set such that the
      coordinate (0,0) represents the upper left corner of
      the component.
    * The Graphics object's clip rectangle is set to the area
      of the component that is in need of repainting.

Basically, the paint() method is always called with a brand new Graphics
object.  The Graphics object you use during one call to paint() is
disposed soon after your paint() method returns so any remaining state
on it is simply lost.  The system was not designed to persist state from
one call to the next, but to always start your paint() method with a
consistent inherited state - any state requirements beyond the above
conditions should be maintained separately by your application and
applied each time the method is called.

The article goes into much more detail about the architecture and is a
recommended reading for anyone trying to do more than some basic
rendering and management of graphics state...

                       ...jim

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to