void connectionFailed() { login.setEnabled(true); logout.setEnabled(false); // whoIsIn.setEnabled(false); chatStatus.setText("Please login first"); chatField.setText(""); // reset port number and host name as a construction time tfPort.setText("" + defaultPort); tfServer.setText(defaultHost); // let the user change them tfServer.setEditable(false); tfPort.setEditable(false); // don't react to a <CR> after the username chatField.removeActionListener(this); connected = false; }
public void validAuthenticate() { chatStatus.setText("Enter your message below"); connected = true; // disable login button login.setEnabled(false); // enable the 2 buttons logout.setEnabled(true); // whoIsIn.setEnabled(true); // disable the Server and Port JTextField tfServer.setEditable(false); tfPort.setEditable(false); // Action listener for when the user enter a message chatField.addActionListener(this); switchCards("Menu"); }