2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
6 package uk.ac.ntu.n0521366.wsyd.client;
10 * @author Eddie Berrisford-Lynch
12 public class Chat extends javax.swing.JDialog {
15 * Creates new form WSYD_Chat
17 public Chat(java.awt.Frame parent, boolean modal) {
23 * This method is called from within the constructor to initialize the form.
24 * WARNING: Do NOT modify this code. The content of this method is always
25 * regenerated by the Form Editor.
27 @SuppressWarnings("unchecked")
28 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
29 private void initComponents() {
30 java.awt.GridBagConstraints gridBagConstraints;
32 gPanelChatInstance = new javax.swing.JPanel();
33 jScrollPane1 = new javax.swing.JScrollPane();
34 gListChatWindow = new javax.swing.JList();
35 jPanel2 = new javax.swing.JPanel();
36 gButtonAttach = new javax.swing.JButton();
37 jScrollPane2 = new javax.swing.JScrollPane();
38 gTAreaMessage = new javax.swing.JTextArea();
39 gButtonSend = new javax.swing.JButton();
40 gTPanelNewChat = new javax.swing.JTabbedPane();
42 gPanelChatInstance.setMinimumSize(new java.awt.Dimension(450, 350));
43 gPanelChatInstance.setPreferredSize(new java.awt.Dimension(450, 350));
44 gPanelChatInstance.setLayout(new java.awt.BorderLayout());
46 gListChatWindow.setFont(new java.awt.Font("Dialog", 0, 12)); // NOI18N
47 gListChatWindow.setModel(new javax.swing.AbstractListModel() {
48 String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
49 public int getSize() { return strings.length; }
50 public Object getElementAt(int i) { return strings[i]; }
52 gListChatWindow.setPreferredSize(new java.awt.Dimension(300, 180));
53 gListChatWindow.setVisibleRowCount(20);
54 jScrollPane1.setViewportView(gListChatWindow);
56 gPanelChatInstance.add(jScrollPane1, java.awt.BorderLayout.CENTER);
58 jPanel2.setPreferredSize(new java.awt.Dimension(450, 70));
59 jPanel2.setLayout(new java.awt.GridBagLayout());
61 gButtonAttach.setFont(new java.awt.Font("Dialog", 1, 10)); // NOI18N
62 gButtonAttach.setText("Attach");
63 gButtonAttach.setPreferredSize(new java.awt.Dimension(94, 50));
64 gridBagConstraints = new java.awt.GridBagConstraints();
65 gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
66 jPanel2.add(gButtonAttach, gridBagConstraints);
68 jScrollPane2.setMinimumSize(new java.awt.Dimension(256, 100));
70 gTAreaMessage.setColumns(20);
71 gTAreaMessage.setRows(6);
72 jScrollPane2.setViewportView(gTAreaMessage);
74 jPanel2.add(jScrollPane2, new java.awt.GridBagConstraints());
76 gButtonSend.setText("Send");
77 gButtonSend.setPreferredSize(new java.awt.Dimension(94, 50));
78 gridBagConstraints = new java.awt.GridBagConstraints();
79 gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
80 jPanel2.add(gButtonSend, gridBagConstraints);
82 gPanelChatInstance.add(jPanel2, java.awt.BorderLayout.PAGE_END);
84 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
86 gTPanelNewChat.setMinimumSize(new java.awt.Dimension(450, 350));
87 gTPanelNewChat.setPreferredSize(new java.awt.Dimension(500, 400));
89 javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
90 getContentPane().setLayout(layout);
91 layout.setHorizontalGroup(
92 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
93 .addComponent(gTPanelNewChat, javax.swing.GroupLayout.PREFERRED_SIZE, 500, javax.swing.GroupLayout.PREFERRED_SIZE)
95 layout.setVerticalGroup(
96 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
97 .addComponent(gTPanelNewChat, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)
101 }// </editor-fold>//GEN-END:initComponents
104 * @param args the command line arguments
106 public static void main(String args[]) {
107 /* Set the Nimbus look and feel */
108 //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
109 /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
110 * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
113 for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
114 if ("Nimbus".equals(info.getName())) {
115 javax.swing.UIManager.setLookAndFeel(info.getClassName());
119 } catch (ClassNotFoundException ex) {
120 java.util.logging.Logger.getLogger(Chat.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
121 } catch (InstantiationException ex) {
122 java.util.logging.Logger.getLogger(Chat.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
123 } catch (IllegalAccessException ex) {
124 java.util.logging.Logger.getLogger(Chat.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
125 } catch (javax.swing.UnsupportedLookAndFeelException ex) {
126 java.util.logging.Logger.getLogger(Chat.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
131 /* Create and display the dialog */
132 java.awt.EventQueue.invokeLater(new Runnable() {
134 Chat dialog = new Chat(new javax.swing.JFrame(), true);
135 dialog.addWindowListener(new java.awt.event.WindowAdapter() {
137 public void windowClosing(java.awt.event.WindowEvent e) {
141 dialog.setVisible(true);
146 // Variables declaration - do not modify//GEN-BEGIN:variables
147 private javax.swing.JButton gButtonAttach;
148 private javax.swing.JButton gButtonSend;
149 private javax.swing.JList gListChatWindow;
150 private javax.swing.JPanel gPanelChatInstance;
151 private javax.swing.JTextArea gTAreaMessage;
152 private javax.swing.JTabbedPane gTPanelNewChat;
153 private javax.swing.JPanel jPanel2;
154 private javax.swing.JScrollPane jScrollPane1;
155 private javax.swing.JScrollPane jScrollPane2;
156 // End of variables declaration//GEN-END:variables