Skip to content
This repository has been archived by the owner on Jul 16, 2022. It is now read-only.

Commit

Permalink
Icon: change icon generation to imageIO from Toolkit
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Miura <miurahr@linux.com>
  • Loading branch information
miurahr committed Nov 1, 2021
1 parent 27b087d commit 8e0b2d4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/java/io/github/eb4j/ebview/utils/ResourceUtil.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package io.github.eb4j.ebview.utils;

import javax.imageio.ImageIO;
import java.awt.Image;
import java.awt.Toolkit;
import java.io.IOException;
import java.net.URL;

public final class ResourceUtil {
Expand Down Expand Up @@ -33,7 +34,13 @@ private ResourceUtil() {
*/
public static Image getImage(final String resourceName) {
URL resourceURL = ResourceUtil.class.getResource(resourceName);
return Toolkit.getDefaultToolkit().getImage(resourceURL);
if (resourceURL != null) {
try {
return ImageIO.read(resourceURL);
} catch (IOException ignored) {
}
}
return null;
}

/**
Expand Down

0 comments on commit 8e0b2d4

Please sign in to comment.