如果我的PANEL上有两个Graphics,那么paint()怎么指明时哪个Graphics?"对当前显示的图形对象"
怎样确定哪个是当前图形对象,是不是
bufferGraphics.drawLine(start.x,start.y,end.x,end.y);
repaint();
repaint()跟在bufferGraphics后,bufferGraphics就为当前图形对象?
怎样确定哪个是当前图形对象,是不是
bufferGraphics.drawLine(start.x,start.y,end.x,end.y);
repaint();
repaint()跟在bufferGraphics后,bufferGraphics就为当前图形对象?
E:\JAVA\myjava\ex>appletviewer -debug plot.html
Initializing jdb ...
> run
run sun.applet.Main plot.html
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started:
Exception occurred: java.lang.NullPointerException (uncaught)"thread=AWT-EventQu
eue-1", java.awt.EventDispatchThread.run(), line=114 bci=23我不知道 bci=23是什么意思?我的line=114是public void run(){
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
while (Thread.currentThread() == animThread) {
delta=System.currentTimeMillis()-lastTime;
/*System.out.println("3.Go,go.go!");*/
if(isRun){
int[] value=new int[30];
int total=0;
for(int i=0;i<30;i++)
value[i]=(int)(doubleRandom((double)(plotDim.height*0.05),(double)(plotDim.height*0.95)));
for(int i=0;i<30;i++){
bufferGraphics.setColor(Color.blue);
bufferGraphics.drawLine((int)((plotDim.width*0.9* i)/30),value[i],(int)((plotDim.width*0.9* (i+1))/30),value[i+1]);
}
repaint();
lastTime+=delta;
animThread.yield();
try {
animThread.sleep(Math.max(0,lastTime-System.currentTimeMillis()));
} catch (InterruptedException e) {
break;
}
}
}我不知道错在哪里?
-----------repaint(); -----------