// 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.bulenkov.iconloader.util.DoubleColor;
import com.sun.swingset3.DemoProperties;
import com.sun.swingset3.demos.DemoUtilities;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;
        //<snip>Add a horizontal toolbar
        JToolBar toolbar = new JToolBar();
        frame.add(toolbar, BorderLayout.NORTH);
        toolbar.add(new JButton("Toolbar Button"));
        //</snip>

        //<snip>Add the content area
        JLabel label = new JLabel("I'm content but a little blue.");
        label.setHorizontalAlignment(JLabel.CENTER);
        label.setPreferredSize(new Dimension(300, 160));
        label.setBackground(new DoubleColor(new Color(197, 216, 236), new Color(102, 117, 136)));
        label.setOpaque(true); // labels non-opaque by default
        frame.add(label);
        //snip

        //<snip>Add a statusbar
        JLabel statusLabel = new JLabel("I show status.");
        statusLabel.setBorder(new EmptyBorder(4, 4, 4, 4));
        statusLabel.setHorizontalAlignment(JLabel.LEADING);
        frame.add(statusLabel, BorderLayout.SOUTH);
        //</snip>

        //<snip>Initialize frame's size to fit it's content
        frame.pack();
        //</snip>

        return frame;
    }

    public void start() {
// 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/frame/FrameDemo.java
import com.bulenkov.iconloader.util.DoubleColor;
import com.sun.swingset3.DemoProperties;
import com.sun.swingset3.demos.DemoUtilities;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URL;

        //<snip>Add a horizontal toolbar
        JToolBar toolbar = new JToolBar();
        frame.add(toolbar, BorderLayout.NORTH);
        toolbar.add(new JButton("Toolbar Button"));
        //</snip>

        //<snip>Add the content area
        JLabel label = new JLabel("I'm content but a little blue.");
        label.setHorizontalAlignment(JLabel.CENTER);
        label.setPreferredSize(new Dimension(300, 160));
        label.setBackground(new DoubleColor(new Color(197, 216, 236), new Color(102, 117, 136)));
        label.setOpaque(true); // labels non-opaque by default
        frame.add(label);
        //snip

        //<snip>Add a statusbar
        JLabel statusLabel = new JLabel("I show status.");
        statusLabel.setBorder(new EmptyBorder(4, 4, 4, 4));
        statusLabel.setHorizontalAlignment(JLabel.LEADING);
        frame.add(statusLabel, BorderLayout.SOUTH);
        //</snip>

        //<snip>Initialize frame's size to fit it's content
        frame.pack();
        //</snip>

        return frame;
    }

    public void start() {
        DemoUtilities.setToplevelLocation(frame, frameSpaceholder, SwingConstants.CENTER);