Skip to content

Commit

Permalink
update icon
Browse files Browse the repository at this point in the history
  • Loading branch information
kapoorlab committed May 27, 2024
1 parent 8fc2ab1 commit b77506f
Showing 1 changed file with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

0 comments on commit b77506f

Please sign in to comment.