package com.github.noxan.aves.demo.chat;

import java.awt.BorderLayout;
import java.awt.CardLayout;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;

public class ChatClientGUI {
    private JFrame frame;
    private JPanel cards;

    public ChatClientGUI(ChatClient client) {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
        } catch(Exception e) {
        }

        frame = new JFrame();
        frame.setTitle("aves - chatclient");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        cards = new JPanel(new CardLayout());

        frame.add(cards, BorderLayout.CENTER);

        frame.setSize(320, 680);
        frame.setLocationByPlatform(true);
        frame.setVisible(true);
    }
}

@@ -97,61 +97,224 @@
 ut;%0A
-%0Aimport javax.swing.JFrame;%0Aimport javax.swing.JPanel
+import java.awt.event.ActionEvent;%0Aimport java.awt.event.ActionListener;%0A%0Aimport javax.swing.JButton;%0Aimport javax.swing.JFrame;%0Aimport javax.swing.JLabel;%0Aimport javax.swing.JPanel;%0Aimport javax.swing.SwingConstants
 ;%0Aim
@@ -342,16 +342,44 @@
 nager;%0A%0A
+import layout.TableLayout;%0A%0A
 public c
@@ -818,16 +818,72 @@
 yout());
+%0A        cards.add(new ConnectPanel(client), %22connect%22);
 %0A%0A      
@@ -1037,11 +1037,1096 @@
 );%0A    %7D
+%0A%0A    private class ConnectPanel extends JPanel %7B%0A        private static final long serialVersionUID = -8154588851543816456L;%0A%0A        private ChatClient client;%0A%0A        private JButton connectButton;%0A%0A        public ConnectPanel(ChatClient client) %7B%0A            this.client = client;%0A            setLayout(new TableLayout(new double%5B%5D%5B%5D %7B %7B TableLayout.FILL, 0.5f, TableLayout.FILL %7D, %7B TableLayout.FILL, TableLayout.PREFERRED, 5, TableLayout.PREFERRED, TableLayout.FILL %7D %7D));%0A            initComponents();%0A        %7D%0A%0A        private void initComponents() %7B%0A            JLabel offlineLabel = new JLabel(%22Server currently offline.%22);%0A            offlineLabel.setHorizontalAlignment(SwingConstants.CENTER);%0A            add(offlineLabel, %221,1%22);%0A%0A            connectButton = new JButton(%22Try reconnect%22);%0A            connectButton.addActionListener(new ActionListener() %7B%0A                @Override%0A                public void actionPerformed(ActionEvent e) %7B%0A                    client.connect();%0A                %7D%0A            %7D);%0A            add(connectButton, %221,3%22);%0A        %7D%0A    %7D
 %0A%7D%0A

implement connect panel and add to chat gui