File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/main/java/org/scijava/ui/swing/search Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 3636import java .awt .Dimension ;
3737import java .awt .Font ;
3838import java .awt .GridLayout ;
39+ import java .awt .Image ;
3940import java .awt .Window ;
4041import java .awt .event .ActionListener ;
4142import java .awt .event .FocusEvent ;
@@ -701,11 +702,13 @@ private Component icon(final String iconPath) {
701702 }
702703 final URL iconURL = getClass ().getResource (iconPath );
703704 if (iconURL == null ) return emptyIcon ();
704- final ImageIcon icon = new ImageIcon (iconURL );
705+ ImageIcon icon = new ImageIcon (iconURL );
705706 if (icon .getIconWidth () != ICON_SIZE || //
706707 icon .getIconHeight () != ICON_SIZE )
707708 {
708- return emptyIcon ();
709+ // Resize icon to the needed size.
710+ icon = new ImageIcon (icon .getImage ().getScaledInstance (
711+ ICON_SIZE , ICON_SIZE , Image .SCALE_SMOOTH ));
709712 }
710713 return new JLabel (icon );
711714 }
You can’t perform that action at this time.
0 commit comments