package com.seaglasslookandfeel.demo;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
import javax.swing.JToolBar;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

public class TestToolBar {

    public static void main(String[] args) {
        if (true) {
            try {
                // System.setProperty("SeaGlass.Override.os.name", "Windows");
                UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        System.setProperty("apple.laf.useScreenMenuBar", "true");

        SwingUtilities.invokeLater(new Runnable() {
            public void run() {

                JMenuBar mb = new JMenuBar();
                JMenu m1 = new JMenu("File");
                JMenu m2 = new JMenu("Edit");
                JMenu m3 = new JMenu("Help");
                mb.add(m1);
                mb.add(m2);
                mb.add(m3);

                JToolBar toolbar1 = makeToolBar("Toolbar1", JToolBar.HORIZONTAL);
                JToolBar toolbar2 = makeToolBar("Toolbar2", JToolBar.HORIZONTAL);
                JToolBar toolbar3 = makeToolBar("Toolbar3", JToolBar.VERTICAL);
                JToolBar toolbar4 = makeToolBar("Toolbar4", JToolBar.VERTICAL);

                JFrame frame = new JFrame("TestToolBar");
                frame.setJMenuBar(mb);
                frame.getRootPane().putClientProperty("apple.awt.brushMetalLook", Boolean.TRUE);

                JPanel outerPanel = new JPanel(new BorderLayout());
                JPanel panel = new JPanel();
                panel.add(new JLabel("Hi there!"));
                JButton open = new JButton("Open");
                panel.add(open);
                JToolBar tb = new JToolBar();
                tb.add(new JButton("B1"));
                outerPanel.add(panel, BorderLayout.CENTER);
                outerPanel.add(tb, BorderLayout.SOUTH);

                open.addActionListener(new ActionListener() {
                    JFrame newFrame;

                    public void actionPerformed(ActionEvent e) {
                        newFrame = new JFrame("New Window");
                        JPanel panel = new JPanel();
                        panel.setBackground(Color.white);
                        panel.add(new JLabel("Boo!"));
                        JButton close = new JButton("Close");
                        close.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                newFrame.dispose();
                            }
                        });
                        panel.add(close);
                        newFrame.add(panel, BorderLayout.CENTER);
                        newFrame.setSize(300, 200);
                        newFrame.setLocationRelativeTo(null);
                        newFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
                        newFrame.setVisible(true);
                    }
                });

                frame.getContentPane().add(toolbar1, BorderLayout.NORTH);
                frame.getContentPane().add(toolbar2, BorderLayout.SOUTH);
                frame.getContentPane().add(toolbar3, BorderLayout.WEST);
                frame.getContentPane().add(toolbar4, BorderLayout.EAST);
                frame.add(outerPanel, BorderLayout.CENTER);
                frame.setSize(600, 600);
                frame.setLocationRelativeTo(null);
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setVisible(true);
            }

            /**
             * @return
             */
            private JToolBar makeToolBar(String name, int orientation) {
                JButton button1 = new JButton("Test 1");
                JToggleButton button2 = new JToggleButton("Test 2");
                JButton button3 = new JButton("Test 3");

                JToolBar toolbar = new JToolBar(name, orientation);

                JPanel foo = new JPanel();
                foo.add(button3);
                toolbar.add(button1);
                toolbar.addSeparator();
                toolbar.add(button2);
                toolbar.addSeparator();
                toolbar.add(foo);
                return toolbar;
            }
        });
    }

}

@@ -66,31 +66,8 @@
 ut;%0A
-import java.awt.Color;%0A
 impo
@@ -156,32 +156,60 @@
 .swing.JButton;%0A
+import javax.swing.JDialog;%0A
 import javax.swi
@@ -483,16 +483,46 @@
 oolBar %7B
+%0A    %0A    static JFrame frame;
 %0A%0A    pu
@@ -1626,23 +1626,16 @@
         
-JFrame 
 frame = 
@@ -2341,22 +2341,21 @@
    J
-Frame newFrame
+Dialog dialog
 ;%0A%0A 
@@ -2446,41 +2446,43 @@
     
-newFrame = new JFrame(%22New Window
+dialog = new JDialog(frame, %22Dialog
 %22);%0A
@@ -2538,66 +2538,8 @@
 ();%0A
-                        panel.setBackground(Color.white);%0A
     
@@ -2827,24 +2827,22 @@
         
-newFrame
+dialog
 .dispose
@@ -2969,24 +2969,22 @@
         
-newFrame
+dialog
 .add(pan
@@ -3029,32 +3029,30 @@
             
-newFrame
+dialog
 .setSize(300
@@ -3079,32 +3079,30 @@
             
-newFrame
+dialog
 .setLocation
@@ -3147,100 +3147,14 @@
     
-newFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);%0A                        newFrame
+dialog
 .set

Make button open a dialog instead of a frame.