From b77506f651ab88fd10bdb48436f99c35125d73ff Mon Sep 17 00:00:00 2001 From: kapoorlab Date: Mon, 27 May 2024 17:40:09 +0200 Subject: [PATCH] update icon --- .../BtrackDetectorBaseConfigurationPanel.java | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/src/main/java/fiji/plugin/trackmate/Btrack/BtrackDetectorBaseConfigurationPanel.java b/src/main/java/fiji/plugin/trackmate/Btrack/BtrackDetectorBaseConfigurationPanel.java index 89e59bb..06ccedb 100644 --- a/src/main/java/fiji/plugin/trackmate/Btrack/BtrackDetectorBaseConfigurationPanel.java +++ b/src/main/java/fiji/plugin/trackmate/Btrack/BtrackDetectorBaseConfigurationPanel.java @@ -24,7 +24,7 @@ import java.net.URL; import javax.swing.ImageIcon; - +import java.awt.Image; import fiji.plugin.trackmate.Logger; import fiji.plugin.trackmate.Model; import fiji.plugin.trackmate.Settings; @@ -56,21 +56,20 @@ protected static URL getResource( final String name ) { return BtrackDetectorFactory.class.getClassLoader().getResource( name ); } - + public static ImageIcon createScaledIcon(String path, int width, int height) { + // Load the original ImageIcon + ImageIcon originalIcon = new ImageIcon(getResource(path)); + + // Get the Image from the ImageIcon + Image originalImage = originalIcon.getImage(); + + // Scale the Image to the desired size + Image scaledImage = originalImage.getScaledInstance(width, height, Image.SCALE_SMOOTH); + + // Create a new ImageIcon from the scaled Image + return new ImageIcon(scaledImage); + } } -public static ImageIcon createScaledIcon(String path, int width, int height) { - // Load the original ImageIcon - ImageIcon originalIcon = new ImageIcon(Icons.class.getResource(path)); - - // Get the Image from the ImageIcon - Image originalImage = originalIcon.getImage(); - - // Scale the Image to the desired size - Image scaledImage = originalImage.getScaledInstance(width, height, Image.SCALE_SMOOTH); - - // Create a new ImageIcon from the scaled Image - return new ImageIcon(scaledImage); -} \ No newline at end of file