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); } } }
/** Handles CheckboxMenuItem state changes. */ public void itemStateChanged(ItemEvent e) { MenuItem item = (MenuItem) e.getSource(); MenuComponent parent = (MenuComponent) item.getParent(); String cmd = e.getItem().toString(); if ((Menu) parent == Menus.window) WindowManager.activateWindow(cmd, item); else doCommand(cmd); }