Ho aggiustato un po le cose e nella classe Configure dove effettuo la modifica alla porta ho scritto questo codice:
codice:
FileConfig f=new FileConfig();
f.setPort(Integer.parseInt(jTextField12.getText()));
if (frame.getMain().getServer() !=null && !(frame.getMain().getServer().getPort()==Integer.parseInt(jTextField12.getText()))){
//annulla la socket attiva e ne ricrea un'altra
f.writeProperties();
frame.getMain().getServer().Stop();
Server server=new Server(Integer.parseInt(jTextField12.getText()),frame);
try{
server.setConfigure(this);
server.setGUI(frame);
server.Start();
f.setPath(jTextField11.getText());
f.setIDShip(Byte.parseByte(jTextField1.getText()));
f.writeProperties();
this.dispose();
}catch(IOException ioe)
{
}
}
f.setPath(jTextField11.getText());
f.setIDShip(Byte.parseByte(jTextField1.getText()));
f.writeProperties();
JOptionPane.showMessageDialog(this,"Changes made correctly");
come si puo vedere nella classe Server dove creo la ServerSocket ho messo una GUI , allora quando mi creo il nuovo oggetto server (sulla nuova porta) inizializzo tale GUI.
ma stranamente anche così la GUI si blocca e si rovina.
tulipan