1 36 37 40 41 42 import javax.swing.*; 43 import javax.swing.event.*; 44 import javax.swing.text.*; 45 import javax.swing.border.*; 46 import javax.swing.colorchooser.*; 47 import javax.swing.filechooser.*; 48 import javax.accessibility.*; 49 50 import java.awt.*; 51 import java.awt.event.*; 52 import java.beans.*; 53 import java.util.*; 54 import java.io.*; 55 import java.applet.*; 56 import java.net.*; 57 58 64 65 public class SwingSet2Applet extends JApplet { 66 public void init() { 67 getContentPane().setLayout(new BorderLayout()); 68 getContentPane().add(new SwingSet2(this), BorderLayout.CENTER); 69 } 70 71 public URL getURL(String filename) { 72 URL codeBase = this.getCodeBase(); 73 URL url = null; 74 75 try { 76 url = new URL(codeBase, filename); 77 System.out.println(url); 78 } catch (java.net.MalformedURLException e) { 79 System.out.println("Error: badly specified URL"); 80 return null; 81 } 82 83 return url; 84 } 85 86 87 } 88 | Popular Tags |