package examples.example5_chat_OO_library; import java.awt.Color; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import javax.swing.JButton; import javax.swing.JFrame; import simpleNetworking.Client; /** * TODO Put here a description of what this class does. * * @author mutchler. * Created May 12, 2009. */ public class ChatFrame extends JFrame { /** * TODO Put here a description of what this constructor does. * * @param client */ public ChatFrame(final Client client) { this.setSize(1000, 800); this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); this.add(new ChatPanel("She said:", Color.pink, new Dimension(400, 800))); this.add(new ChatPanel("I said:", Color.yellow, new Dimension(400, 800))); JButton quitButton = new JButton("Quit"); this.add(quitButton); quitButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { client.writeLine("QUIT"); } catch (IOException exception) { // TODO Auto-generated catch-block stub. exception.printStackTrace(); } client.close(); } }); this.setVisible(true); } }