package com.hello.dialog;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Frame extends JFrame {
    public Frame(){
        this.setTitle("Hello Frame");
        this.setSize(300, 300);
        this.setLocation(300, 300);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        this.setLayout(new BorderLayout());
        this.setResizable(false);
        this.setVisible(true);

        // create panel
        JPanel topPanel = new JPanel();
        topPanel.setLayout(new FlowLayout());
        this.add(topPanel, BorderLayout.NORTH);

        // Create buttons
        topPanel.add(new JButton("Btn1"));
        topPanel.add(new JButton("Btn2"));
        topPanel.add(new JButton("Btn3"));

        // create panel
        JPanel bottomPanel = new JPanel();
        bottomPanel.setLayout(new BorderLayout());
        this.add(bottomPanel, BorderLayout.SOUTH);

        // Create buttons
        bottomPanel.add(new JButton("Btn4"), BorderLayout.CENTER);
        bottomPanel.add(new JButton("Btn5"), BorderLayout.NORTH);
        bottomPanel.add(new JButton("Btn6"), BorderLayout.WEST);
        bottomPanel.add(new JButton("Btn7"), BorderLayout.EAST);

        // create panel
        JPanel centerPanel = new JPanel();
        Box verticalBox = Box.createVerticalBox();
        centerPanel.add(verticalBox);
        this.add(centerPanel, BorderLayout.CENTER);

        // Create buttons
        final JFrame frame = this;
        verticalBox.add(new JButton("About") {{
            addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    Dialog.showDialog(frame, frame);
                }
            });
        }});
    }
}

@@ -133,16 +133,39 @@
 istener;
+%0Aimport java.util.Date;
 %0A%0Apublic
@@ -1069,22 +1069,21 @@
 rLayout.
-CENTER
+NORTH
 );%0A     
@@ -1127,37 +1127,38 @@
 ), BorderLayout.
-NORTH
+CENTER
 );%0A        botto
@@ -1334,32 +1334,136 @@
 = new JPanel();%0A
+        centerPanel.setLayout(new BorderLayout());%0A        this.add(centerPanel, BorderLayout.CENTER);%0A%0A
         Box vert
@@ -1532,27 +1532,49 @@
 ticalBox
+, BorderLayout.CENTER
 );%0A
+%0A
         
 this.add
@@ -1569,113 +1569,525 @@
     
-this.add(centerPanel, BorderLayout.CENTER);%0A%0A        // Create buttons%0A        final JFrame frame = this;
+final JTextArea textArea = new JTextArea();%0A        textArea.setEditable(false);%0A%0A        // Create buttons%0A        final JFrame frame = this;%0A        verticalBox.add(new JButton(%22Edit%22) %7B%7B%0A            addActionListener(new ActionListener() %7B%0A                @Override%0A                public void actionPerformed(ActionEvent e) %7B%0A                    textArea.insert(String.format(%22Edit %25d: %25s%5Cn%22, textArea.getLineCount(), new Date().toString()), 0);%0A                %7D%0A            %7D);%0A        %7D%7D, BorderLayout.NORTH);%0A
 %0A   
@@ -2368,16 +2368,92 @@
       %7D%7D
+, BorderLayout.NORTH);%0A%0A        verticalBox.add(textArea, BorderLayout.SOUTH
 );%0A    %7D

Add TextArea