if (panel instanceof ChatRoomPanel) {
ChatRoomPanel window = (ChatRoomPanel) panel;
//if this frame is closed as a result of connection loss and we
// try to leave
//the channel, it will not work, so we need to catch it.
window.removed();
try {
window.leave();
} catch (IllegalStateException e) {
com.valhalla.Logger