コード例 #1
0
  public void itemStateChanged(ItemEvent E) {
    // The 'log chat' checkbox
    if (E.getSource() == logChat) {
      server.logChats = logChat.getState();

      // Loop through all of the chat rooms, and set the logging
      // state to be the same as the value of the checkbox
      for (int count = 0; count < server.chatRooms.size(); count++) {
        babylonChatRoom tmp = (babylonChatRoom) server.chatRooms.elementAt(count);
        try {
          tmp.setLogging(server.logChats);
        } catch (IOException e) {
          server.serverOutput(
              server.strings.get(thisClass, "togglelogerror") + " " + tmp.name + "\n");
        }
      }
    }

    // The user list
    if (E.getSource() == userList) {
      // If anything is selected, enable the 'disconnect user'
      // button, otherwise disable it
      synchronized (userList) {
        disconnect.setEnabled(userList.getSelectedItem() != null);
      }
    }
  }