LUCENE-10340: Fix resource path for image files in luke module (#569)

This commit is contained in:
Tomoko Uchida 2021-12-26 14:36:42 +09:00 committed by GitHub
parent 54ebf3c73b
commit eed2601542
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1 additions and 3 deletions

View File

@ -23,14 +23,12 @@ import javax.swing.ImageIcon;
/** Image utilities */
public class ImageUtils {
private static final String IMAGE_BASE_DIR = "org/apache/lucene/luke/app/desktop/img/";
public static ImageIcon createImageIcon(String name, int width, int height) {
return createImageIcon(name, "", width, height);
}
public static ImageIcon createImageIcon(String name, String description, int width, int height) {
java.net.URL imgURL = ImageUtils.class.getClassLoader().getResource(IMAGE_BASE_DIR + name);
java.net.URL imgURL = ImageUtils.class.getResource(name);
if (imgURL != null) {
ImageIcon originalIcon = new ImageIcon(imgURL, description);
ImageIcon icon =