posted 14 years ago
Hi All
Here is my problem. My application is chat application which normally it is doing correctly between client and server with SWING components seperately. Client and Server having two seperate windows which are working fine when they seperately chat to each other.
Now problem creating when i m embedded this application into JFrame window. I m using Main window(JFrame by keep layout as null) like yahoo chat. Client and Server layouts are different it means they are using GridLayout and panel. I added one dynamic button in Main window which performs an action to open Server program. Server program having a run method where ServerSocket initialise are present.
Button having code like this using actionlistener or mouselistener for label
Server2 myobj=new Server2(); //This line is fine
myobj.myServer(); // But problem from this line ...
When i m clicking on that dynamic button. My server socket chat window becomes blur means nothing it is display on the screen except only Title bar even though every component set properly and running fine while doing seperately with the client.
When Client is sending the data to Server. Connection established properly and getting the result in the background flow of Server program but not in the text area of Server chat window.
When i m terminating the client application. What ever the messages client window had sent to server window i can see it ...
So, I need you people to help me how to overcome this problem , it is very urgent please help me out from this situation.
Server window should highlight all its button once i click to button. Why it is totally becoming white in color( without displaying nothing ). When Client windows terminates, then only it is showing ... So why and give me code where i need to make a change
When i m invoking this method, it is hiding everything. Is't the problem with the layout betwen two windows ( main & Server window) or . Any flow is wrong ? ...Please let me know
Code for Server -
public void myServer()
{
//for receive connections
try {
server=new ServerSocket(12345,100);
while( true )
{
try {
System.out.println("yes");
System.out.println(" Before waiting connection");
mywaitConnection();
System.out.println(" After connecting to client and before stream data");
getMyStreamData();
System.out.println(" After stream data but before process connections");
processMyConnection();
}
catch(EOFException ef)
{ System.err.println("error"+ef); }
finally { closeConnection(); ++counter;
} //step 5 connection close
} //end of while
} // end of outer try
catch( IOException ioe ) { ioe.printStackTrace(); }
}