diff options
author | Yana Stamcheva <yana@jitsi.org> | 2012-11-22 23:11:47 +0000 |
---|---|---|
committer | Yana Stamcheva <yana@jitsi.org> | 2012-11-22 23:11:47 +0000 |
commit | 8b9632895911d5c9936b01885b76642a80a02684 (patch) | |
tree | 7dc9ebd76fd92ead63757c25240b24d8fa7e0366 /src/net/java/sip/communicator/util | |
parent | fff370944f2dc4ad4b6be54323ca9b3a9ef70071 (diff) | |
download | jitsi-8b9632895911d5c9936b01885b76642a80a02684.zip jitsi-8b9632895911d5c9936b01885b76642a80a02684.tar.gz jitsi-8b9632895911d5c9936b01885b76642a80a02684.tar.bz2 |
Fixes NullPointerException in ExtendedTooltip.
Diffstat (limited to 'src/net/java/sip/communicator/util')
-rw-r--r-- | src/net/java/sip/communicator/util/swing/ExtendedTooltip.java | 73 |
1 files changed, 22 insertions, 51 deletions
diff --git a/src/net/java/sip/communicator/util/swing/ExtendedTooltip.java b/src/net/java/sip/communicator/util/swing/ExtendedTooltip.java index 077c4c1..dfd27c7 100644 --- a/src/net/java/sip/communicator/util/swing/ExtendedTooltip.java +++ b/src/net/java/sip/communicator/util/swing/ExtendedTooltip.java @@ -109,61 +109,32 @@ public class ExtendedTooltip * adding a WindowFocusListener without removing the same * WindowFocusListener later on is guaranteed to cause a memory leak. */ - parentWindow.addWindowFocusListener(new WindowFocusListener() - { - public void windowLostFocus(WindowEvent e) + if (parentWindow != null) + parentWindow.addWindowFocusListener(new WindowFocusListener() { - Window popupWindow - = SwingUtilities.getWindowAncestor(ExtendedTooltip.this); - - if ((popupWindow != null) - && popupWindow.isVisible() - // The popup window should normally be a JWindow, so we - // check here explicitly if for some reason we didn't get - // something else. - && (popupWindow instanceof JWindow)) + public void windowLostFocus(WindowEvent e) { - if (logger.isInfoEnabled()) - logger.info("Tooltip window ancestor to hide: " - + popupWindow); - - popupWindow.setVisible(false); + Window popupWindow + = SwingUtilities.getWindowAncestor( + ExtendedTooltip.this); + + if ((popupWindow != null) + && popupWindow.isVisible() + // The popup window should normally be a JWindow, so we + // check here explicitly if for some reason we didn't + // get something else. + && (popupWindow instanceof JWindow)) + { + if (logger.isInfoEnabled()) + logger.info("Tooltip window ancestor to hide: " + + popupWindow); + + popupWindow.setVisible(false); + } } - } - public void windowGainedFocus(WindowEvent e) {} - }); - - // Comments this code as it hides the tool tip once it's opened and this - // appears as a buggy behavior. - // Hide the tooltip if the parent window isn't active -// addComponentListener(new ComponentAdapter() -// { -// public void componentResized(ComponentEvent evt) -// { -// if (!parentWindow.isActive()) -// { -// Window popupWindow -// = SwingUtilities.getWindowAncestor( -// ExtendedTooltip.this); -// -// if (popupWindow != null -// && popupWindow.isVisible() -// && !(popupWindow instanceof JFrame) -// // The popup window should normally be a JWindow, so we -// // check here explicitly if for some reason we didn't -// // get something else. -// && (popupWindow instanceof JWindow)) -// { -// if (logger.isInfoEnabled()) -// logger.info("Tooltip window ancestor to hide: " -// + popupWindow); -// -// popupWindow.setVisible(false); -// } -// } -// } -// }); + public void windowGainedFocus(WindowEvent e) {} + }); this.add(mainPanel); } |