so I have this java file, it has two classes: RPClient which has main method. and RPClientOpsImlp is being a listener which accepts messages from server and changes GUI.
here is simplified code.
Here is the file:
import java.io.*;
import java.lang.*;
import org.omg.CORBA.*;
import RPSGame.*;
import org.omg.CosNaming.* ;
import org.omg.CosNaming.NamingContextPackage.*;
import java.net.*;
import javax.swing.JOptionPane;
public class RPClient
{
public static void main(String args[])
{
try{
RPSGU rps = new RPSGU();
rps.pack();
rps.setVisible(true);
String playerName = JOptionPane.showInputDialog(rps, "Please enter your player name.");
rps.SetMyName(playerName);
} catch (Exception e) {
System.out.println("ERROR : " + e) ;
e.printStackTrace(System.out);
}
}
}
class RPClientOpsImpl implements RPClientOpsOperations{
public void callBack(String message) {
RPSGU rps = new RPSGU();
rps.SetMyName("NewName");
}
}
Basically in RPClientOpsImpl I tried calling the GUI and update it's label but that doesn't work. RPSGU is a .java file of GUI which has this function:
public void SetProgress(String label){
progress.setText(label);
}