//#############################################################
SwingUtilities.invokeLater(new Runnable() {
public void run() {
final TransparentLoginPanel pan = Singleton.get().getGuiController()
.displayUserPasswordJPanel();
// get properties initialized from file or by defaut
pan.setServer(System.getProperty(UserPropertiesDAO.SERVER_HOST_PROPERTY)+":"+System.getProperty(UserPropertiesDAO.SERVER_PORT_PROPERTY));
// action that gets executed in the update thread:
pan.addLoginActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// this gets executed in jme thread
// do 3d system calls in jme thread only!
// SoundController.getInstance().playOnetime("sound/click.ogg", false, Vector3f.ZERO);
String[] split = pan.getServer().split(":");
if(split.length<2) {
Singleton.get().getGuiController().showErrorDialog("Check your server:port entry");
return;
}
try {
//store setting in user property for later usage
System.setProperty(UserPropertiesDAO.SERVER_HOST_PROPERTY,split[0]);
System.setProperty(UserPropertiesDAO.SERVER_PORT_PROPERTY,split[1]);
//intentionally not used
Integer.parseInt(split[1]);
} catch (NumberFormatException ex) {
Singleton.get().getGuiController().showErrorDialog("Your port is not a number entry");
return;
}
if ( !initNetwork(pan.getUsername(), pan.getPassword(), pan.getServer()) ) {
doLogin();
Singleton.get().getGuiController()
.showErrorDialog(
"Failed to Connect to login server");
} else {
//save port and host to user.home on a successfull login
UserPropertiesDAO.saveProperties();
Singleton.get().getGuiController().removeAll();
}
}
});
pan.addCancelActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
// this gets executed in jme thread
// do 3d system calls in jme thread only!
// finished = true;