// import javax.swing.*; import java.net.URL; import java.io.IOException; public class ResourceDemo extends JApplet { public void init() { URL urlToResource = Thread. currentThread(). getContextClassLoader(). getResource("message.txt"); JEditorPane editorPane; try { editorPane = new JEditorPane(urlToResource); } catch(IOException ioe) { editorPane = new JEditorPane(); editorPane.setText("I/O Exception " + ioe.getMessage()); } getContentPane().add(editorPane); } }