I am doin a Some Socket Programing Stuff in Java.. Here i have created a button(Create Server)..and when i click it ,it starts server...but i want to change the button name to (Stop Server) after Starting the server... so i did this.. but when i press start server it starts and the button name remains the same...
and when a client gets connected to it ,then it change the name to stop server...
tell me whats the wrong with this code??
Here is My a SomePart Of Code...
public void actionPerformed(ActionEvent ex)
{
if(ex.getActionCommand() == "CreateServer")
{
bt1.setText("Stop Server");
bt2.setEnabled(false);
b5.setText("Server Started On Port " + tf2.getText());
System.out.println("Server started 1");
create(Integer.parseInt(tf2.getText())); //my func. to create server
System.out.println("Server started 2");
}
}
and my create() fucn. contains some sockets and thread...so tell me what the problem...