// 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.DemoProperties;
import com.sun.swingset3.demos.DemoUtilities;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

    public void start() {
        DemoUtilities.setToplevelLocation(window, windowSpaceholder, SwingConstants.CENTER);
        showWindow();
    }

    public void stop() {
        //<snip>Hide window
        window.setVisible(false);
        //</snip>
    }

    public void showWindow() {
        //<snip>Show window
        // if window already visible, then bring to the front
        if (window.isShowing()) {
            window.toFront();
        } else {
            window.setVisible(true);
        }
        //</snip>
    }

    private class ShowActionListener implements ActionListener {
        public void actionPerformed(ActionEvent actionEvent) {
            showWindow();
        }
    }

    public static void main(String args[]) {
// 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/demos/window/WindowDemo.java
import com.sun.swingset3.DemoProperties;
import com.sun.swingset3.demos.DemoUtilities;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


    public void start() {
        DemoUtilities.setToplevelLocation(window, windowSpaceholder, SwingConstants.CENTER);
        showWindow();
    }

    public void stop() {
        //<snip>Hide window
        window.setVisible(false);
        //</snip>
    }

    public void showWindow() {
        //<snip>Show window
        // if window already visible, then bring to the front
        if (window.isShowing()) {
            window.toFront();
        } else {
            window.setVisible(true);
        }
        //</snip>
    }

    private class ShowActionListener implements ActionListener {
        public void actionPerformed(ActionEvent actionEvent) {
            showWindow();
        }
    }

    public static void main(String args[]) {
        EventQueue.invokeLater(new Runnable() {