Package jaouaniChat

Source Code of jaouaniChat.accueilChat

package jaouaniChat;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.EventQueue;

import javax.print.attribute.standard.DateTimeAtCompleted;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import java.awt.TextArea;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import com.jgoodies.forms.factories.DefaultComponentFactory;
import javax.swing.SwingConstants;
import java.awt.Font;
import javax.swing.ImageIcon;
import java.awt.Canvas;
import javax.swing.border.BevelBorder;
import javax.swing.border.LineBorder;
import javax.swing.border.SoftBevelBorder;
import javax.swing.border.EtchedBorder;
import javax.swing.UIManager;
import javax.swing.border.TitledBorder;
import javax.swing.JRadioButton;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.Calendar;
import java.util.Date;

public class accueilChat extends JFrame {

  private JPanel contentPane;
  private JTextField textField;

  /**
   * Launch the application.
   */
  public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {
      public void run() {
        try {
          accueilChat frame = new accueilChat();
          frame.setVisible(true);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    });
  }

  /**
   * Create the frame.
   */
  public accueilChat() {
    setBackground(Color.BLUE);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 800, 600);
    contentPane = new JPanel();
    contentPane.setBackground(Color.WHITE);
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(null);
   
    contentPane.setBackground(new Color(0,0,153));
   
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.setBackground(Color.GRAY);
    tabbedPane.setBounds(20, 32, 762, 507);
    contentPane.add(tabbedPane);
   
    JPanel panel_6 = new JPanel();
    panel_6.setBackground(new Color(255,255,204));
    tabbedPane.addTab("Home", null, panel_6, null);
    panel_6.setLayout(null);
   
    JPanel panel = new JPanel();
    panel.setBorder(UIManager.getBorder("InternalFrame.border"));
    panel.setLayout(null);
    panel.setForeground(Color.LIGHT_GRAY);
    panel.setBackground(Color.LIGHT_GRAY);
    panel.setBounds(10, 26, 254, 441);
    panel_6.add(panel);
   
    JPanel panel_2 = new JPanel();
    panel_2.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panel_2.setBackground(Color.ORANGE);
    panel_2.setBounds(20, 11, 216, 36);
    panel.add(panel_2);
   
    JLabel label = new JLabel("CHATROOM LIST");
    label.setForeground(Color.WHITE);
    panel_2.add(label);
   
    JPanel panel_4 = new JPanel();
    panel_4.setBackground(Color.WHITE);
    panel_4.setLayout(null);
    panel_4.setBounds(20, 66, 216, 364);
    panel.add(panel_4);
   
    JPanel panel_1 = new JPanel();
    panel_1.setBorder(UIManager.getBorder("InternalFrame.border"));
    panel_1.setLayout(null);
    panel_1.setBackground(Color.LIGHT_GRAY);
    panel_1.setBounds(274, 26, 377, 441);
    panel_6.add(panel_1);
   
    JPanel panel_3 = new JPanel();
    panel_3.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    panel_3.setBackground(Color.BLUE);
    panel_3.setBounds(10, 11, 357, 36);
    panel_1.add(panel_3);
   
    JLabel label_1 = new JLabel("CONNECTED PEOPLE");
    label_1.setForeground(Color.WHITE);
    panel_3.add(label_1);
   
    JPanel panel_5 = new JPanel();
    panel_5.setBackground(Color.WHITE);
    panel_5.setLayout(null);
    panel_5.setBounds(10, 69, 357, 361);
    panel_1.add(panel_5);
   
    JLabel label_3 = DefaultComponentFactory.getInstance().createLabel("");
    label_3.setIcon(new ImageIcon("C:\\Documents and Settings\\admin\\Mes documents\\cours\\MIAGE\\workspace\\tacos-framework\\src\\icHome.PNG"));
    label_3.setBounds(661, 0, 106, 96);
    panel_6.add(label_3);
   
    JLabel label_4 = DefaultComponentFactory.getInstance().createLabel("");
    label_4.setIcon(new ImageIcon("C:\\Documents and Settings\\admin\\Mes documents\\cours\\MIAGE\\workspace\\tacos-framework\\src\\Copie de Jtchat.JPG"));
    label_4.setBounds(671, 95, 86, 388);
    panel_6.add(label_4);
   
    JPanel panel_7 = new JPanel();
    panel_7.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, Color.DARK_GRAY, null, null, null));
    panel_7.setBackground(Color.ORANGE);
    panel_7.setPreferredSize(new Dimension(410, 100));
    tabbedPane.addTab("Chatroom", null, panel_7, null);
    panel_7.setLayout(null);
   
    JPanel panel_8 = new JPanel();
    panel_8.setBorder(UIManager.getBorder("CheckBox.border"));
    panel_8.setBackground(new Color(250,255,250));
    panel_8.setBounds(39, 58, 673, 409);
    panel_7.add(panel_8);
    panel_8.setLayout(null);
   
    final TextArea textArea = new TextArea();
    textArea.setBounds(35, 40, 512, 268);
    panel_8.add(textArea);
    textField = new JTextField();
    textField.addKeyListener(new KeyAdapter() {
      @Override
      public void keyPressed(KeyEvent e) {
        String t;
        Date date = new Date();
        t=date.toString();
        if (e.getKeyCode() == KeyEvent.VK_ENTER)
        {
        textArea.setText(textArea.getText()+ " " + "\n\n" + t);
        textArea.setText(textArea.getText()+ " " + "\n" + textField.getText());
        textField.setText("");
        }
      }
    });
   
    textField.setBounds(55, 341, 466, 22);
    panel_8.add(textField);
    textField.setColumns(10);
   
    JButton btnNewButton = new JButton("Send");
    btnNewButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent arg0) {
        String t;
        Date date = new Date();
        t=date.toString();
        textArea.setText(textArea.getText()+ " " + "\n\n" + t);
        textArea.setText(textArea.getText()+ " " + "\n" + textField.getText());
        textField.setText("");
      }
    });
    btnNewButton.setBounds(548, 340, 73, 23);
    panel_8.add(btnNewButton);
   
    JLabel lblChatroomName_1 = DefaultComponentFactory.getInstance().createTitle("Chatroom Name");
    lblChatroomName_1.setForeground(Color.WHITE);
    lblChatroomName_1.setFont(new Font("Serif", Font.BOLD | Font.ITALIC, 16));
    lblChatroomName_1.setHorizontalAlignment(SwingConstants.CENTER);
    lblChatroomName_1.setBounds(535, 0, 200, 50);
    panel_7.add(lblChatroomName_1);
   
    JLabel label_2 = DefaultComponentFactory.getInstance().createLabel("");
    label_2.setIcon(new ImageIcon("C:\\Documents and Settings\\admin\\Mes documents\\cours\\MIAGE\\workspace\\tacos-framework\\src\\affiche-chatroom-mini.jpg"));
    label_2.setBounds(0, -2, 248, 52);
    panel_7.add(label_2);
   
  }
}
TOP

Related Classes of jaouaniChat.accueilChat

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.