-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add icons and set them on the window. (#3)
- Loading branch information
Showing
7 changed files
with
44 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package net.minecraftforge.installer; | ||
|
||
import javax.imageio.ImageIO; | ||
import java.awt.Image; | ||
import java.awt.image.BufferedImage; | ||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
final class Images { | ||
private Images() { | ||
} | ||
|
||
static List<Image> getWindowIcons() { | ||
List<Image> result = new ArrayList<>(); | ||
result.add(getImage("/icons/neoforged_background_16x16.png")); | ||
result.add(getImage("/icons/neoforged_background_32x32.png")); | ||
result.add(getImage("/icons/neoforged_background_128x128.png")); | ||
return result; | ||
} | ||
|
||
static BufferedImage getImage(String path) { | ||
return getImage(path, null); | ||
} | ||
|
||
static BufferedImage getImage(String path, String default_) { | ||
try { | ||
InputStream in = SimpleInstaller.class.getResourceAsStream(path); | ||
if (in == null && default_ != null) | ||
in = new ByteArrayInputStream(InstallerPanel.hexToByteArray(default_)); | ||
return ImageIO.read(in); | ||
} catch (IOException e) { | ||
if (default_ == null) | ||
throw new RuntimeException(e); | ||
else | ||
return new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.