Code Snippet Issue
Hello,
I have a code simple screen which has some text fields and a submit button. On Click of the button, all the fields that have been entered are stored in string variables and passed to a function in another class (after instantiating the class).
FIRST CLASS FILE:
publicclass myclassextends JPanelimplements ActionListener{
JTextField kk;
JTextField qk;
JButton bk;
public myclass(){
kk =new JTextField(5);
qk =new JTextField(5);
button =new JButton();
button.addActionListener(this);
\\some more instantiations
}
publicvoid BuildGUI(){
\\usual GUI frame.add and stuff
}
publicvoid actionPerformed(ActionEvent ev){
String kk1 = kk.getText();
String qk1= qk.getText();
AnotherClass ac =new AnotherClass();
ac.sending(kk1, qk1);
}
publicstaticvoid main(){
myclass mm =new myclass();
mm.BuildGUI();
}
SECOND CLASS FILE:
publicclass AnotherClass(){
publicvoid sending(String a, String b)
{
try{
int aint = Integer.parseInt(a);
double bdouble = Integer.parseDouble(b);
\\Creation of ServerSockets
while(true)
{
\\Accept connections from clients
\\Other code
}
}catch(Exception ex){ex.printStackTrace();}
}
}
Problem: The GUI frame that was created in class one's main() does not close, no matter what. The button on it does appear disabled. My guess is it must be ending up in the infinite loop of server accepting connections. Can anyone please suggest a workaround to this problem, in the sense can some code alignment be changed to close the frame once parameters have been successfully passed to the next function?
Thanks,

