public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { ChatRoomWrapper chatRoom = (ChatRoomWrapper) value; this.setText(chatRoom.getChatRoomName()); Image chatRoomImage = ImageLoader.getImage(ImageLoader.CHAT_ROOM_16x16_ICON); if (chatRoom.getChatRoom() == null || !chatRoom.getChatRoom().isJoined()) { chatRoomImage = LightGrayFilter.createDisabledImage(chatRoomImage); } this.setIcon(new ImageIcon(chatRoomImage)); this.setFont(this.getFont().deriveFont(Font.PLAIN)); if (isSelected) this.setBackground(table.getSelectionBackground()); else this.setBackground(UIManager.getColor("Table.background")); return this; }
/** Opens the currently selected chat. */ void openChatForSelection() { Object selectedValue = this.chatRoomsTableModel.getValueAt(this.chatRoomList.getSelectedRow()); ChatRoomWrapper chatRoomWrapper; if (selectedValue instanceof ChatRoomWrapper) chatRoomWrapper = (ChatRoomWrapper) selectedValue; else return; if (!chatRoomWrapper.getChatRoom().isJoined()) { GuiActivator.getUIService().getConferenceChatManager().joinChatRoom(chatRoomWrapper); } ChatWindowManager chatWindowManager = GuiActivator.getUIService().getChatWindowManager(); ChatPanel chatPanel = chatWindowManager.getMultiChat(chatRoomWrapper, true); chatWindowManager.openChat(chatPanel, true); }