public void actionPerformed(ActionEvent ae) { String cmd = ae.getActionCommand().intern(); if (ae.getSource() == butChannel) { String pass = null; String channel = (String) cboChannels.getSelectedItem(); if (channels.containsKey(channel) && ((Boolean) channels.get(channel)).booleanValue()) { String message = "Password for " + channel + "? (blank for no password)"; pass = JOptionPane.showInputDialog( (Component) ae.getSource(), message, "Join Channel", JOptionPane.QUESTION_MESSAGE); } server.writeObject(new SD_Channel(false, channel, ("".equals(pass) ? null : pass))); showUserStatus = false; } else if (ae.getSource() == butCreate) { String channel = JOptionPane.showInputDialog( (Component) ae.getSource(), "Enter the name of the channel", "Create Channel", JOptionPane.INFORMATION_MESSAGE); if (channel == null) return; String message = "Password for " + channel + "? (blank for no password)"; String pass = JOptionPane.showInputDialog( (Component) ae.getSource(), message, "Join Channel", JOptionPane.QUESTION_MESSAGE); server.writeObject(new SD_Channel(true, channel, ("".equals(pass) ? null : pass))); showUserStatus = false; // ---------- Invite a Specific User } else if (ae.getSource() == butInvite) { String invite = JOptionPane.showInputDialog( (Component) ae.getSource(), "Enter the name of the User to Invite", "Invite User", JOptionPane.INFORMATION_MESSAGE); if (invite == null) return; messageText.setText("\\invite " + invite); sendMessage(); } else if (cmd == "whisper") { String user = (String) userList.getSelectedValue(); if (user != null && !messageText.getText().equals("") && !user.equals(username)) { messageText.setText("\\whisper " + user + " " + messageText.getText()); sendMessage(); } else { error( "invalid user or no message, type a message below," + " select a user, and then whisper"); } } else if (cmd == "private message") { String user = (String) userList.getSelectedValue(); if (user != null && !user.equals(username)) { privates.newPrivate(user); } else { error("invalid user"); } } else if (ae.getActionCommand().equals("ignore")) { String user = (String) userList.getSelectedValue(); if (user != null) { ignore(user, false); } else { error("no user selected"); } } else if (cmd == "clear ignore list") { ignores.clear(); updateList(); serverMessage("ignore list cleared"); } else if (cmd == "kick user") { String user = (String) userList.getSelectedValue(); if (user != null) { if (user.equals(username)) { error("cannot kick yourself"); } else { server.writeObject(new SD_Kick(user)); } } else { error("no user selected"); } } }