Friday, June 3, 2011













This is the most important class, here
Here the whiteboard frame and other related frames are attached.
http://pastebin.com/8bHxcbkZ

p5.add("West",new Label(" TextBox"));
p4.add("West",new Label(" ChatHere:"));

This code is used to put the Chat button and Text boxes.
There have 1)ToolBox, 2) whiteboard 3) Text 4)Text Box 5)ChatHere 6)Undo button 7)upload 8)Send button
ToolBox- This is contained with Tools that help to draw the figure.
Whiteboard- The place where we draw the figure
Text- when The "Text" is used, the contain of this field is drawn into the whiteboard.
TextBox- The Chat text will be displayed into this field.
ChatHere- This contain of the field will be sent as a chat text.
Undo button- if any1 wants to undo the picture, it will help
Upload- when this button is clicked a new File selection box is opened where the user can choose the appropriate file which is transfer to the other users.














  1. int answer = myApp.fc.showOpenDialog(this);
    if (answer == JFileChooser.APPROVE_OPTION)


    File file = myApp.fc.getSelectedFile();


These line help me to create the file chooser.
The Action of Upload button is written in below.


file.getAbsolutePath()

It is used to Get the absolute path of a file.The following Link helps me create the file chooser.!

Thursday, June 2, 2011

Chat Module

Server side coding.........

WhiteboardChatServer.java

Description : -
In this class, simple concept of socket programing is used.

new WhiteboardChatServer(s);

The program create a thread to store, share and edit the chat data. When a client request is accepted by initiator, for each client a new thread is started in server.


socket s is the reference of the incoming the socket. where ss is the server socket where the incoming socket data is stored.

osChat is the array List where the chat data is stored. the Array List is shared by all the other users.
Synchronized word is used on "osChat", because when a client is accessing the data other client can not access the same data.

Client Side coding : ----


this is client side code
when client wants to connect with server, he sends a socket to server, if the server accepts the request , he begins to chat!!
here two separate process is working.
1) Updating the chat box.(read)
2) if any text is entered, it is sent to server!(write)

n=new ChatInputThread(www,streamOut);

This line is used to create the write operation
while(true)
{
try
{
String line = console.readLine();
String Line=www.ccf.getText();
www.ccf.setText(Line+line);
}
catch(Exception e)
{
System.out.print("chatclient error"+e);
}
}
ths operation is used for continuous updation of the chat box, if new data is read then it will update the text field, ccf.

ChatInputThread.java



This thread is used to scan the input continuously, if any data is inserted and the submit button is pressed then this thread helps to send the data to server.

here
Whiteboard s1;
s1 stores the reference of the containing whiteboard.

String line=s1.cf.getText();

This is the text which is entered in textfield cf and updated into the server.

s1.TextBoxUpdateFlag=0;
TextBoxUpdateFlag is a flag in main whiteboard, if any data is entered the flag becomes 1 (true)
after updating the data at server, the thread changes it with 0.

Aritecture of the system

First i want to mention that i divide the software in two section, Foreground section where all foreground processes or threads are working that take input from user and throw the collected data to background section. The background section is nothing but the Data storage section. When users open the software,automatically this section will be started. The duty of the Background section is to collect ,store and distribute the Data to proper user.
The reason why i choose this concept because of that if i put the Foreground section in any server than it will work like server client architecture.
In the absent of server, The initiator (i.e. who is sending the request to the other clients to join with his module) does the job of the server, in that case all data will be stored into initiator's machine n the client's(including initiator) foreground thread communicate with the initiator background section.

Introduction

All of us are familiar with Google Talk, Yahoo messenger etc. These are the very famous chat client.
But the main Concept of these chat client is,This is a simple multiuser chat software. Users do not need internet connectivity or any account to use it. The four modules Voice Chat, White board, Text chat and file transfer are available in this software.
The software is coded into Java , it can be used in any platform like Linux Widows.
User can create a voice conference, make shared chatbox, white board with multiuser. Picture saver are also available into whiteboard module. if some one wants to save whatever he has drawn into the Whiteboard, he can save it.
This also can use through internet.