브라우저에서 애플릿을 실행할 때 nullpointer excetion을 얻는 반면 애플릿 뷰어를 통해 정상적으로 작동합니다.JApplet에서 이미지를로드하는 동안 널 포인터 예외가 발생했습니다.
titleicon=new ImageIcon(this.getClass().getClassLoader().getResource("image.jpg"));
img=new JLabel(titleicon)
파일 위치 : .class 파일과 이미지 파일은 모두 같은 폴더에 있습니다.
C : \ 프로젝트 \의 game.class
C : \ 프로젝트 나는 아무도 브라우저에서 작동하지 않고 모든 애플릿 뷰어로 괜찮, differennt 변화 아래 시도
\의 image.jpg를 :
titleicon=new ImageIcon(this.getClass().getResource("image.jpg"));
titleicon=new ImageIcon(getClass().getClassLoader().getResource("image.jpg"));
'titleicon = new ImageIcon (새 URL (getCodeBase())'이미지 .jpg "));' –