public abstract class Graphics
extends Object
The Graphics class is the abstract base class for all graphics contexts that allow an application to draw onto components that are realized on various devices, as well as onto off-screen images. A Graphics object encapsulates state information needed for the basic rendering operations that Java supports. This state information includes the following properties: 
The Component object on which to draw. 
A translation origin for rendering and clipping coordinates. 
The current clip. 
The current color. 
The current font. 
The current logical pixel operation function (XOR or Paint). 
The current XOR alternation color. 

解决方案 »

  1.   

    g.translate(x,y);
    //将原点改到原坐标系中的(x,y)点
    canvas.update(g);
    //canvas是Canvas类型的;如果你用的是Canvas的paint()方法的话
      

  2.   

    请问,update方法可以放在任何方法中么?
      

  3.   

    但是repaint的时候,之前的update方法设定的Graphics对象又不行了,又成了原来的Graphics对象了。
      

  4.   

    update是JFrame的方法,从JFrame继承的类可以用
    repaint是java.awt.Component及其子类的方法
    你的这种情况需要知道更详细的信息才能判断是什么原因
      

  5.   

    可以看看这里
    http://java.sun.com/products/jfc/tsc/articles/painting/index.html