// Path: demo/swingset3/com/sun/swingset3/demos/DemoUtilities.java
// public class DemoUtilities {
//     private DemoUtilities() {
//         // Hide constructor
//     }
// 
//     public static void setToplevelLocation(Window toplevel, Component component,
//             int relativePosition) {
// 
//         Rectangle compBounds = component.getBounds();
// 
//         // Convert component location to screen coordinates
//         Point p = new Point();
//         SwingUtilities.convertPointToScreen(p, component);
// 
//         int x;
//         int y;
// 
//         // Set frame location to be centered on panel
//         switch (relativePosition) {
//             case SwingConstants.NORTH: {
//                 x = (p.x + (compBounds.width / 2)) - (toplevel.getWidth() / 2);
//                 y = p.y - toplevel.getHeight();
//                 break;
//             }
//             case SwingConstants.EAST: {
//                 x = p.x + compBounds.width;
//                 y = (p.y + (compBounds.height / 2)) - (toplevel.getHeight() / 2);
//                 break;
//             }
//             case SwingConstants.SOUTH: {
//                 x = (p.x + (compBounds.width / 2)) - (toplevel.getWidth() / 2);
//                 y = p.y + compBounds.height;
//                 break;
//             }
//             case SwingConstants.WEST: {
//                 x = p.x - toplevel.getWidth();
//                 y = (p.y + (compBounds.height / 2)) - (toplevel.getHeight() / 2);
//                 break;
//             }
//             case SwingConstants.NORTH_EAST: {
//                 x = p.x + compBounds.width;
//                 y = p.y - toplevel.getHeight();
//                 break;
//             }
//             case SwingConstants.NORTH_WEST: {
//                 x = p.x - toplevel.getWidth();
//                 y = p.y - toplevel.getHeight();
//                 break;
//             }
//             case SwingConstants.SOUTH_EAST: {
//                 x = p.x + compBounds.width;
//                 y = p.y + compBounds.height;
//                 break;
//             }
//             case SwingConstants.SOUTH_WEST: {
//                 x = p.x - toplevel.getWidth();
//                 y = p.y + compBounds.height;
//                 break;
//             }
//             default:
//             case SwingConstants.CENTER: {
//                 x = (p.x + (compBounds.width / 2)) - (toplevel.getWidth() / 2);
//                 y = (p.y + (compBounds.height / 2)) - (toplevel.getHeight() / 2);
//             }
//         }
//         toplevel.setLocation(x, y);
//     }
// 
//     public static boolean browse(URI uri) throws IOException {
//         // Try using the Desktop api first
//         try {
//             Desktop desktop = Desktop.getDesktop();
//             desktop.browse(uri);
// 
//             return true;
//         } catch (SecurityException e) {
//         }
// 
//         return false;
//     }
// }


import com.sun.swingset3.demos.DemoUtilities;
import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import javax.swing.text.*;
import javax.swing.text.html.HTML;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.ObjectView;
import java.awt.*;
import java.util.EventListener;
            final Component component = super.createComponent();

            Runnable notifier = new Runnable() {
                public void run() {
                    final ComponentCreationListener listeners[] =
                            HTMLPanel.this.listenerList.getListeners(ComponentCreationListener.class);
                    for (ComponentCreationListener l : listeners) {
                        l.componentCreated(HTMLPanel.this, component);
                    }
                }
            };
            // just in case document is being loaded in separate thread. (?)
            if (EventQueue.isDispatchThread()) {
                notifier.run();
            } else {
                EventQueue.invokeLater(notifier);
            }
            return component;
        }
    }

    // single instance of handler is shared for ALL DemoPanel instances
    public static class HyperlinkHandler implements HyperlinkListener {
        Cursor defaultCursor;

        public void hyperlinkUpdate(HyperlinkEvent event) {
            JEditorPane descriptionPane = (JEditorPane) event.getSource();
            HyperlinkEvent.EventType type = event.getEventType();
            if (type == HyperlinkEvent.EventType.ACTIVATED) {
                try {
// Path: demo/swingset3/com/sun/swingset3/demos/DemoUtilities.java
// public class DemoUtilities {
//     private DemoUtilities() {
//         // Hide constructor
//     }
// 
//     public static void setToplevelLocation(Window toplevel, Component component,
//             int relativePosition) {
// 
//         Rectangle compBounds = component.getBounds();
// 
//         // Convert component location to screen coordinates
//         Point p = new Point();
//         SwingUtilities.convertPointToScreen(p, component);
// 
//         int x;
//         int y;
// 
//         // Set frame location to be centered on panel
//         switch (relativePosition) {
//             case SwingConstants.NORTH: {
//                 x = (p.x + (compBounds.width / 2)) - (toplevel.getWidth() / 2);
//                 y = p.y - toplevel.getHeight();
//                 break;
//             }
//             case SwingConstants.EAST: {
//                 x = p.x + compBounds.width;
//                 y = (p.y + (compBounds.height / 2)) - (toplevel.getHeight() / 2);
//                 break;
//             }
//             case SwingConstants.SOUTH: {
//                 x = (p.x + (compBounds.width / 2)) - (toplevel.getWidth() / 2);
//                 y = p.y + compBounds.height;
//                 break;
//             }
//             case SwingConstants.WEST: {
//                 x = p.x - toplevel.getWidth();
//                 y = (p.y + (compBounds.height / 2)) - (toplevel.getHeight() / 2);
//                 break;
//             }
//             case SwingConstants.NORTH_EAST: {
//                 x = p.x + compBounds.width;
//                 y = p.y - toplevel.getHeight();
//                 break;
//             }
//             case SwingConstants.NORTH_WEST: {
//                 x = p.x - toplevel.getWidth();
//                 y = p.y - toplevel.getHeight();
//                 break;
//             }
//             case SwingConstants.SOUTH_EAST: {
//                 x = p.x + compBounds.width;
//                 y = p.y + compBounds.height;
//                 break;
//             }
//             case SwingConstants.SOUTH_WEST: {
//                 x = p.x - toplevel.getWidth();
//                 y = p.y + compBounds.height;
//                 break;
//             }
//             default:
//             case SwingConstants.CENTER: {
//                 x = (p.x + (compBounds.width / 2)) - (toplevel.getWidth() / 2);
//                 y = (p.y + (compBounds.height / 2)) - (toplevel.getHeight() / 2);
//             }
//         }
//         toplevel.setLocation(x, y);
//     }
// 
//     public static boolean browse(URI uri) throws IOException {
//         // Try using the Desktop api first
//         try {
//             Desktop desktop = Desktop.getDesktop();
//             desktop.browse(uri);
// 
//             return true;
//         } catch (SecurityException e) {
//         }
// 
//         return false;
//     }
// }


// Path: demo/swingset3/com/sun/swingset3/utilities/HTMLPanel.java
import com.sun.swingset3.demos.DemoUtilities;
import javax.swing.*;
import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener;
import javax.swing.text.*;
import javax.swing.text.html.HTML;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.ObjectView;
import java.awt.*;
import java.util.EventListener;

            final Component component = super.createComponent();

            Runnable notifier = new Runnable() {
                public void run() {
                    final ComponentCreationListener listeners[] =
                            HTMLPanel.this.listenerList.getListeners(ComponentCreationListener.class);
                    for (ComponentCreationListener l : listeners) {
                        l.componentCreated(HTMLPanel.this, component);
                    }
                }
            };
            // just in case document is being loaded in separate thread. (?)
            if (EventQueue.isDispatchThread()) {
                notifier.run();
            } else {
                EventQueue.invokeLater(notifier);
            }
            return component;
        }
    }

    // single instance of handler is shared for ALL DemoPanel instances
    public static class HyperlinkHandler implements HyperlinkListener {
        Cursor defaultCursor;

        public void hyperlinkUpdate(HyperlinkEvent event) {
            JEditorPane descriptionPane = (JEditorPane) event.getSource();
            HyperlinkEvent.EventType type = event.getEventType();
            if (type == HyperlinkEvent.EventType.ACTIVATED) {
                try {
                    DemoUtilities.browse(event.getURL().toURI());