Posted by ¹ÚÇü¹è on August 19, 1997 at 09:45:55:
¾È³çÇϼ¼¿ä?
¾Èµ¿¿¡ ¹ÚÇü¹èÀÔ´Ï´Ù.
ShowDocument¸¦ »ç¿ëÇØ º¼·Á°í Çϴµ¥
°è¼ÓÇؼ Null pointer Exception Error°¡ ³²´Ï´Ù.
´©°¡ ¼Ò½º Á» º¸½Ã°í Àß ¸øµÈ Á¡ Á» ÁöÀûÇØ ÁÖ¼¼¿ä.
±×·³
------------------- ¼Ò ½º --------------------------
// {$R noname01.JFM} import java.awt.*; import java.applet.Applet; import java.applet.AppletContext; import java.net.*; // Class noname01 public class linktest extends Applet { //Class // AppletContext appletContext; final int MenuBarHeight = 0; // Component Declaration public TextField TextField1; public Button Button1; public String urlString = "http://www.andong.ac.kr/"; public URL url = null; // End of Component Declaration // init() public void init() { // Frame Initialization setForeground(Color.black); setBackground(Color.lightGray); setFont(new Font("Dialog",Font.BOLD,12)); setLayout(null); // End of Frame Initialization // Component Initialization TextField1 = new TextField("http://"); TextField1.setForeground(Color.black); TextField1.setBackground(Color.white); TextField1.setFont(new Font("Dialog",Font.BOLD,12)); Button1 = new Button("Button1"); Button1.setFont(new Font("Dialog",Font.BOLD,12)); // End of Component Initialization // Add()s add(Button1); add(TextField1); // End of Add()s InitialPositionSet(); } // End of init() // start() public void start() { } // End of start() // stop() public void stop() { } // End of stop() // destroy() public void destroy() { } // End of destroy() public void paint(Graphics g) { // paint() // End of paint() } public void InitialPositionSet() { // InitialPositionSet() resize(392,122); TextField1.reshape(22,18+MenuBarHeight,353,24); Button1.reshape(20,71+MenuBarHeight,357,25); // End of InitialPositionSet() } public boolean handleEvent(Event evt) { if (evt.target == Button1) { try { url = new URL(urlString); System.out.println("URL: " + urlString); } catch (MalformedURLException e) { System.out.println("Malformed URL: " + urlString); getAppletContext().showStatus(urlString); getAppletContext().showDocument(url, "_blank"); } if (url != null) { getAppletContext().showDocument(url); getAppletContext(). showStatus("Melong"); } } return super.handleEvent(evt); } } // End of Class noname01