From 88f86aaa10f5fd4a58030c2ebb3a972a4534e364 Mon Sep 17 00:00:00 2001 From: Yana Stamcheva Date: Sat, 29 Jan 2011 10:53:10 +0000 Subject: [PATCH] Fixes Esc behavior in chat window. --- .../impl/gui/main/chat/ChatPanel.java | 47 +++++++++---------- .../impl/gui/main/chat/ChatWindow.java | 3 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java index d5c6d6119..362abe66b 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatPanel.java @@ -151,6 +151,7 @@ public ChatPanel(ChatContainer chatContainer) topPanel.setBackground(Color.WHITE); topPanel.setBorder( BorderFactory.createMatteBorder(1, 0, 1, 0, Color.GRAY)); + initTypingNotificationLabel(); this.writeMessagePanel = new ChatWritePanel(this); @@ -347,31 +348,12 @@ public Window getConversationContainerWindow() */ public void addTypingNotification(String typingNotification) { - if (typingNotificationLabel == null) - { - typingNotificationLabel - = new JLabel( typingNotification, - typingIcon, - SwingConstants.CENTER); - - typingNotificationLabel.setPreferredSize(new Dimension(500, 20)); - typingNotificationLabel.setForeground(Color.GRAY); - typingNotificationLabel.setFont( - typingNotificationLabel.getFont().deriveFont(11f)); - typingNotificationLabel.setVerticalTextPosition(JLabel.BOTTOM); - typingNotificationLabel.setHorizontalTextPosition(JLabel.LEFT); - typingNotificationLabel.setIconTextGap(0); - topPanel.add(typingNotificationLabel, BorderLayout.SOUTH); - } - else - { - typingNotificationLabel.setText(typingNotification); + typingNotificationLabel.setText(typingNotification); - if (typingNotification != null && !typingNotification.equals(" ")) - typingNotificationLabel.setIcon(typingIcon); - else - typingNotificationLabel.setIcon(null); - } + if (typingNotification != null && !typingNotification.equals(" ")) + typingNotificationLabel.setIcon(typingIcon); + else + typingNotificationLabel.setIcon(null); revalidate(); repaint(); @@ -385,6 +367,23 @@ public void removeTypingNotification() addTypingNotification(" "); } + /** + * Initializes the typing notification label. + */ + private void initTypingNotificationLabel() + { + typingNotificationLabel + = new JLabel(" ", SwingConstants.CENTER); + + typingNotificationLabel.setPreferredSize(new Dimension(500, 20)); + typingNotificationLabel.setForeground(Color.GRAY); + typingNotificationLabel.setFont( + typingNotificationLabel.getFont().deriveFont(11f)); + typingNotificationLabel.setVerticalTextPosition(JLabel.BOTTOM); + typingNotificationLabel.setHorizontalTextPosition(JLabel.LEFT); + typingNotificationLabel.setIconTextGap(0); + topPanel.add(typingNotificationLabel, BorderLayout.SOUTH); + } /** * Returns the conversation panel, contained in this chat panel. diff --git a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java index 8e603a3dc..222850ecc 100644 --- a/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java +++ b/src/net/java/sip/communicator/impl/gui/main/chat/ChatWindow.java @@ -711,7 +711,8 @@ else if (writePanelRightMenu.isVisible()) writePanelRightMenu.setVisible(false); } else if ((menuBar.getSelectedMenu() != null) - || mainToolBar.getSmileysBox().isVisible()) + || mainToolBar.getSmileysBox() + .getPopupMenu().isVisible()) { MenuSelectionManager.defaultManager().clearSelectedPath(); }