public void actionPerformed(ActionEvent event) { if (event.getSource() == joinButton) { if (joinButton.isSelected()) { mThread = new MulticastThread( Integer.valueOf(portField.getText()), chatIPField.getText(), chatroomArea, true); (new Thread(mThread)).start(); } } if (event.getSource() == sendButton) { mThread.send(usernameField.getText(), chatMsgField.getText()); chatMsgField.setText(""); } if (event.getSource() == leaveButton) { try { joinButton.setSelected(false); mThread.leave(); System.out.println("Disconnected from chat "); } catch (Exception e) { } } if (event.getSource() == exitButton) { System.exit(0); } }