diff --git a/src/main/java/envoy/client/ui/IconUtil.java b/src/main/java/envoy/client/ui/IconUtil.java
index 47588ab..25d6513 100644
--- a/src/main/java/envoy/client/ui/IconUtil.java
+++ b/src/main/java/envoy/client/ui/IconUtil.java
@@ -9,6 +9,9 @@ import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
/**
+ * Provides static utility methods for loading icons from the resource
+ * folder.
+ *
* Project: envoy-client
* File: IconUtil.java
* Created: 16.03.2020
@@ -20,10 +23,34 @@ public class IconUtil {
private IconUtil() {}
+ /**
+ * Loads an icon from resource folder and scales it to a given size.
+ *
+ * @param path the path to the icon inside the resource folder
+ * @param size the size to scale the icon to
+ * @return the scaled icon
+ * @throws IOException if the loading process failed
+ * @since Envoy v0.1-beta
+ */
public static ImageIcon load(String path, int size) throws IOException {
return new ImageIcon(ImageIO.read(IconUtil.class.getResourceAsStream(path)).getScaledInstance(size, size, Image.SCALE_SMOOTH));
}
+ /**
+ *
+ * Loads icons specified by an enum. The images have to be named like the
+ * lowercase enum constants with {@code .png} extension and be located inside a
+ * folder with the lowercase name of the enum, which must be contained inside
+ * the {@code /icons} folder.
+ *
+ * @param the enum that specifies the icons to load
+ * @param enumClass the class of the enum
+ * @param size the size to scale the icons to
+ * @return a map containing the loaded icons with the corresponding enum
+ * constants as keys
+ * @throws IOException if the loading process failed
+ * @since Envoy v0.1-beta
+ */
public static > EnumMap loadByEnum(Class enumClass, int size) throws IOException {
var icons = new EnumMap(enumClass);
var path = "/icons/" + enumClass.getSimpleName().toLowerCase() + "/";