diff --git a/Core/src/org/sleuthkit/autopsy/filequery/ImageThumbnailPanel.java b/Core/src/org/sleuthkit/autopsy/filequery/ImageThumbnailPanel.java index 6e8f2a6c57..38f8ac51e3 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/ImageThumbnailPanel.java +++ b/Core/src/org/sleuthkit/autopsy/filequery/ImageThumbnailPanel.java @@ -37,7 +37,7 @@ public class ImageThumbnailPanel extends javax.swing.JPanel implements ListCellR private static final long serialVersionUID = 1L; private static final Color SELECTION_COLOR = new Color(0, 120, 215); - private static final int ICON_SIZE =16; + private static final int ICON_SIZE = 16; private static final String RED_CIRCLE_ICON_PATH = "org/sleuthkit/autopsy/images/red-circle-exclamation.png"; private static final String YELLOW_CIRCLE_ICON_PATH = "org/sleuthkit/autopsy/images/yellow-circle-yield.png"; private static final String DELETE_ICON_PATH = "/org/sleuthkit/autopsy/images/file-icon-deleted.png"; @@ -175,12 +175,12 @@ public class ImageThumbnailPanel extends javax.swing.JPanel implements ListCellR public String getToolTipText(MouseEvent event) { if (event != null) { //gets tooltip of internal panel item mouse is over - Point p = event.getPoint(); + Point point = event.getPoint(); for (Component comp : getComponents()) { - if (comp instanceof JComponent && p.x >= comp.getX() && p.x <= comp.getX() + ICON_SIZE && p.y >= comp.getY() && p.y <= comp.getY() + ICON_SIZE) { + if (isPointInComponent(comp, point)) { String toolTip = ((JComponent) comp).getToolTipText(); if (toolTip == null || toolTip.isEmpty()) { - return null; + return null; } else { return toolTip; } @@ -190,4 +190,8 @@ public class ImageThumbnailPanel extends javax.swing.JPanel implements ListCellR return null; } + private boolean isPointInComponent(Component comp, Point point) { + return comp instanceof JComponent && point.x >= comp.getX() && point.x <= comp.getX() + ICON_SIZE && point.y >= comp.getY() && point.y <= comp.getY() + ICON_SIZE; + } + } diff --git a/Core/src/org/sleuthkit/autopsy/filequery/VideoThumbnailPanel.java b/Core/src/org/sleuthkit/autopsy/filequery/VideoThumbnailPanel.java index bfd9570c18..96c3102e9d 100644 --- a/Core/src/org/sleuthkit/autopsy/filequery/VideoThumbnailPanel.java +++ b/Core/src/org/sleuthkit/autopsy/filequery/VideoThumbnailPanel.java @@ -41,7 +41,7 @@ final class VideoThumbnailPanel extends javax.swing.JPanel implements ListCellRe private static final int GAP_SIZE = 4; private static final Color SELECTION_COLOR = new Color(0, 120, 215); - private static final int ICON_SIZE =16; + private static final int ICON_SIZE = 16; private static final String RED_CIRCLE_ICON_PATH = "org/sleuthkit/autopsy/images/red-circle-exclamation.png"; private static final String YELLOW_CIRCLE_ICON_PATH = "org/sleuthkit/autopsy/images/yellow-circle-yield.png"; private static final String DELETE_ICON_PATH = "/org/sleuthkit/autopsy/images/file-icon-deleted.png"; @@ -209,13 +209,8 @@ final class VideoThumbnailPanel extends javax.swing.JPanel implements ListCellRe //gets tooltip of internal panel item mouse is over Point p = event.getPoint(); for (Component comp : getComponents()) { - if (comp instanceof JComponent && p.x >= comp.getX() && p.x <= comp.getX() + ICON_SIZE && p.y >= comp.getY() && p.y <= comp.getY() + ICON_SIZE) { - String toolTip = ((JComponent) comp).getToolTipText(); - if (toolTip == null || toolTip.isEmpty()) { - return null; - } else { - return toolTip; - } + if (comp instanceof JComponent && p.x >= comp.getX() && p.x <= comp.getX() + ICON_SIZE && p.y >= comp.getY() && p.y <= comp.getY() + ICON_SIZE && ((JComponent) comp).getToolTipText() != null && !((JComponent) comp).getToolTipText().isEmpty()) { + return ((JComponent) comp).getToolTipText(); } } }