diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java index 3fe9fd08c..61cfca492 100755 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListPanel.java @@ -183,10 +183,10 @@ public void run() ChatWindow msgWindow = (ChatWindow) contactMsgWindows .get(this.contactItem); - if (msgWindow.getExtendedState() == JFrame.ICONIFIED) - msgWindow.setExtendedState(JFrame.NORMAL); - - msgWindow.setVisible(true); + if (msgWindow.isVisible()) + msgWindow.toFront(); + else + msgWindow.setVisible(true); } else { /* @@ -245,10 +245,10 @@ public void windowClosing(WindowEvent e) .setSelectedContactTab(this.contactItem); } - if (tabbedChatWindow.getExtendedState() == JFrame.ICONIFIED) - tabbedChatWindow.setExtendedState(JFrame.NORMAL); - - tabbedChatWindow.setVisible(true); + if (tabbedChatWindow.isVisible()) + tabbedChatWindow.toFront(); + else + tabbedChatWindow.setVisible(true); tabbedChatWindow.getCurrentChatPanel() .requestFocusInWriteArea(); @@ -260,10 +260,10 @@ public void windowClosing(WindowEvent e) .setSelectedContactTab(this.contactItem); } - if (tabbedChatWindow.getExtendedState() == JFrame.ICONIFIED) - tabbedChatWindow.setExtendedState(JFrame.NORMAL); - - tabbedChatWindow.setVisible(true); + if (tabbedChatWindow.isVisible()) + tabbedChatWindow.toFront(); + else + tabbedChatWindow.setVisible(true); tabbedChatWindow.getCurrentChatPanel() .requestFocusInWriteArea(); @@ -309,11 +309,14 @@ public void messageReceived(MessageReceivedEvent evt) Constants.INCOMING_MESSAGE, message.getContent()); if (msgWindow.getState() == JFrame.ICONIFIED) { - msgWindow.setTitle(msgWindow.getTitle() + "*"); + msgWindow.setTitle("*" + msgWindow.getTitle()); } if (Constants.AUTO_POPUP_NEW_MESSAGE) { - msgWindow.setVisible(true); + if(msgWindow.isVisible()) + msgWindow.toFront(); + else + msgWindow.setVisible(true); } } else { @@ -356,7 +359,7 @@ public void windowClosing(WindowEvent e) } }); } - + Hashtable contactTabsTable = tabbedChatWindow .getContactChatsTable(); @@ -374,7 +377,10 @@ public void windowClosing(WindowEvent e) if (Constants.AUTO_POPUP_NEW_MESSAGE) { tabbedChatWindow.addChatTab(chatPanel); - tabbedChatWindow.setVisible(true); + if(tabbedChatWindow.isVisible()) + tabbedChatWindow.toFront(); + else + tabbedChatWindow.setVisible(true); chatPanel.setCaretToEnd(); @@ -397,17 +403,20 @@ public void windowClosing(WindowEvent e) tabbedChatWindow.setSelectedContactTab(metaContact); } - if (!tabbedChatWindow.getTitle().endsWith("*")) { - tabbedChatWindow.setTitle(tabbedChatWindow.getTitle() - + "*"); + if (!tabbedChatWindow.getTitle().startsWith("*")) { + tabbedChatWindow.setTitle( + "*" + tabbedChatWindow.getTitle()); } } else { if (tabbedChatWindow.getTabCount() > 1) { tabbedChatWindow.highlightTab(metaContact); } - - tabbedChatWindow.setVisible(true); + + if(tabbedChatWindow.isVisible()) + tabbedChatWindow.toFront(); + else + tabbedChatWindow.setVisible(true); } } } diff --git a/src/net/java/sip/communicator/impl/gui/main/message/ChatWindow.java b/src/net/java/sip/communicator/impl/gui/main/message/ChatWindow.java index 90f546358..b36db0b51 100755 --- a/src/net/java/sip/communicator/impl/gui/main/message/ChatWindow.java +++ b/src/net/java/sip/communicator/impl/gui/main/message/ChatWindow.java @@ -338,8 +338,7 @@ public void setSelectedContactTab(int index) this.setCurrentChatPanel(chatPanel); this.chatTabbedPane.setSelectedIndex(index); - this.setTitle(chatPanel.getMetaContact().getDisplayName()); - this.setVisible(true); + this.setTitle(chatPanel.getMetaContact().getDisplayName()); chatPanel.requestFocusInWriteArea(); } @@ -653,8 +652,8 @@ public void windowDeiconified(WindowEvent e) { String title = getTitle(); - if (title.endsWith("*")) { - setTitle(title.substring(0, title.length() - 1)); + if (title.startsWith("*")) { + setTitle(title.substring(1, title.length())); } }