package info.danidiaz.xanela.testapp;

import java.awt.BorderLayout;

import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;

/**
 * Hello world!
 *
 */
public class Main 
{
    public static void main( String[] args )
    {
        System.out.println( "Hello World!" );
        
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }
    
    private static void createAndShowGUI() {
        //Create and set up the window.
        JFrame frame = new JFrame();
        frame.setTitle("foo frame");
        frame.getContentPane().setLayout(new BorderLayout());        
        frame.getContentPane().add(new JTextArea(18, 28),BorderLayout.CENTER);
        frame.getContentPane().add(new JButton("foo"),BorderLayout.SOUTH);
        
        JPanel westPanel = new JPanel(new BorderLayout());
        westPanel.add(new JComboBox(new Object [] { "aaa","bbb","cccc"}), BorderLayout.NORTH);
        
        frame.getContentPane().add(westPanel,BorderLayout.EAST);
        frame.getContentPane().add(new JTextField(18),BorderLayout.NORTH);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        //Display the window.
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
    }
}

@@ -61,16 +61,89 @@
 rLayout;
+%0Aimport java.awt.event.ActionEvent;%0Aimport java.awt.event.ActionListener;
 %0A%0Aimport
@@ -194,16 +194,44 @@
 mboBox;%0A
+import javax.swing.JDialog;%0A
 import j
@@ -754,16 +754,22 @@
         
+final 
 JFrame f
@@ -975,16 +975,302 @@
 ENTER);%0A
+        JButton fooButton = new JButton(%22foo%22);%0A        fooButton.addActionListener(new ActionListener() %7B%0A            %0A            @Override%0A            public void actionPerformed(ActionEvent e) %7B%0A                %0A                createAndShowDialog(frame);%0A            %7D%0A        %7D);%0A
         
@@ -1296,34 +1296,25 @@
 e().add(
-new J
+foo
 Button
-(%22foo%22)
 ,BorderL
@@ -1796,16 +1796,16 @@
 (null);%0A
-
         
@@ -1834,10 +1834,827 @@
 ;%0A    %7D%0A
+    %0A    private static void createAndShowDialog(JFrame frame) %7B%0A        final JDialog dialog = new JDialog(frame,true);%0A        dialog.setTitle(%22foo dialog%22);%0A        dialog.getContentPane().setLayout(new BorderLayout());%0A        dialog.getContentPane().add(new JTextArea(18, 10),BorderLayout.CENTER);%0A        JButton dialogButton = new JButton(%22dialog button%22);%0A        dialogButton.addActionListener(new ActionListener() %7B%0A            %0A            @Override%0A            public void actionPerformed(ActionEvent e) %7B%0A                dialog.setVisible(false);%0A                %0A            %7D%0A        %7D);%0A        dialog.getContentPane().add(dialogButton,BorderLayout.NORTH);%0A        //Display the window.%0A        dialog.pack();%0A        dialog.setLocationRelativeTo(null);%0A        dialog.setVisible(true);        %0A    %7D%0A
 %7D%0A

test app now shows a dialog