java.lang.NullPointerException.....


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

±Û¾´ÀÌ :°­´ë½Ä 1998³â 11¿ù 19ÀÏ 14:34:59

appletviewer¿¡¼­´Â ÀÛµ¿ÀÌ µÇ´Âµ¥ ³×½ºÄÉÀÌÇÁ¿¡¼­´Â java.lang.NullPointerException
¶ó´Â ¿¡·¯°¡ ¹ß»ýÇϸ鼭 ÀÛµ¿ÀÌ ¾ÊµÇ´Â±º¿ä..
±×¸®°í º¯¼ö ÀԷ¿¡¼­ Á¤¼öÇü¸»°í float,doubleÀº ÀÔ·ÂÇÏÁö ¸øÇմϱî..??
±×°Ô ¾ÊµÇ¸é StringÀ» float,double·Î º¯È¯ÇÏ´Â ¹æ¹ýÀ̶óµµ
float,doubleÀº StringÀ¸·Î º¯È¯ÀÌ µÇ´Âµ¥ StringÀ» float,double·Î º¯È¯¹æ¹ýÀº
Ã¥¿¡ ³ª¿Í ÀÖÁö°¡ ¾Ê¾Æ¼­¿ä....

import java.awt.*;
import java.applet.*;


public class Dateda extends java.applet.Applet implements Runnable {
int mode ;
final int mode1 = 0;
final int mode2 = 1;
final int mode3 = 2;
final int mode4 = 3;
Thread mythread;
int yx = 0;
int yy = 300;
int delay = 300;
Image s1,s2,ss;
Graphics offg;

public void init() {
setBackground(Color.black);
ss = createImage(size().width,size().height);
offg = ss.getGraphics();
s1 = getImage(getDocumentBase(),"T1.gif");
s2 = getImage(getDocumentBase(),"T2.gif");
}

public void start() {
if (mythread == null){
mythread = new Thread(this);
mythread.start();}

}

public void stop() {

mythread = null;

}
public void paint(Graphics g) {
Color gre= new Color(255,0,100);
offg.drawImage(s1,180,240,null);
offg.drawImage(s2,yx,yy,null);
offg.setColor(gre);
offg.drawString( "hi !",yx,150);
g.drawImage(ss,0,0,this);
}
public void run() {
while(true) {
try {Thread.sleep(delay); }
catch (InterruptedException e) { }
repaint();
doIt();
}

}

public boolean mouseDown(Event evt, int x, int y) {
if( mode == mode4 ) {
yx=0;yy=300;
mode = mode1; }
return true;
}
public void update(Graphics g) {
paint(g);
}
void doIt(){


if ( mode == mode1 ) {
yx+=2;
yy = (int)(300 - 0.0035*yx*yx);
delay =120;
if(yx == 240) {
mode = mode2; }
}
else if ( mode == mode2 ){
yx -=2;
yy = 300 - ((int)Math.sqrt(70*70-(yx-170)*(yx-170))+200);
delay = 100;
if(yx == 100) {
mode = mode3; }
}
else if( mode == mode3 ){
yx +=2;
yy = (int)(300 - (0.0038*(yx-160)*(yx-160)+100));

if(yx == 380) {

mode = mode4; }
}
else if( mode == mode4 ) {
offg.drawString("ya!!",10,30);
}
}
}


´ÙÀ½ ±Ûµé:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
HTML ÅÂ±× Æ÷ÇÔ ¿©ºÎ: HTML ¹®¼­ÀÏ °æ¿ì üũ
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]