/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package pm.Server; import eric.GUI.window.tab_main_panel; import java.io.BufferedReader; import java.io.IOException; import javax.swing.SwingUtilities; /** * * @author PM */ public class Reception implements Runnable { private BufferedReader in = null; private String login = null, message = null, ip = null; private ServerControlPanel scp = null; public Reception(ServerControlPanel scp, BufferedReader in, String login, String ip){ this.scp = scp; this.in = in; this.login = login; this.ip = ip; } private Runnable delete = new Runnable(){ @Override public void run() { scp.delete_client(login, ip); try { in.close(); } catch (Exception e) {} } }; @Override public void run() { try { //while(true){ while(scp.isServerRunning()){ String src = ""; /* while((message = in.readLine())!=null){ src += message+"\n"; } */ message = in.readLine(); while(scp.isServerRunning() && message!=null && !message.equals("END_MESSAGE")){ src += message+"\n"; message = in.readLine(); } //System.out.println(src); try { int n = tab_main_panel.getBTNSsize(); int i = 0; if(src.startsWith("")) { SwingUtilities.invokeLater(new Thread(delete)); } else if(src.contains("")){ //receiving the whole figure while(i") || src.startsWith("") || src.startsWith("") || src.startsWith("")) && !scp.get_collaboration()) ? login + " ("+ip+")" : "Global"; while(i