/* * Yapplet.java * * Created on November 2, 2006, 2:53 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package yapplet; import java.awt.BorderLayout; import javax.swing.JApplet; import javax.swing.JFrame; import javax.swing.SwingUtilities; import javax.swing.UIManager; import netscape.javascript.JSObject; /** * * @author Chet */ public class Yapplet extends JApplet { public void init() { setLayout(new BorderLayout()); JSObject jsWindow = null; try { // This has to be executed with the Applet instance, so we get it // here and pass it into HeadlineViewer jsWindow = JSObject.getWindow(this); } catch (Exception e) { System.out.println("Exception getting jsWindow: " + e); } add(new HeadlineViewer(jsWindow)); } private static void createAndShowGUI() { JFrame f = new JFrame(); UIManager.put("swing.boldMetal", Boolean.FALSE); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(new BorderLayout()); f.setSize(600, 300); Yapplet yapplet = new Yapplet(); yapplet.init(); f.add(yapplet); f.setVisible(true); } public static void main(String[] args) { // Need to do GUI stuff like making the JFrame visible on the // Event Dispatch Thread; do this via invokeLater() Runnable doCreateAndShowGUI = new Runnable() { public void run() { createAndShowGUI(); } }; SwingUtilities.invokeLater(doCreateAndShowGUI); } }