https://github.com/oleg-cherednik/iconmanager
ImageIO plugin for icon formats (ico, icl, icns)
https://github.com/oleg-cherednik/iconmanager
icns ico icon-manager icons imageio java
Last synced: 3 months ago
JSON representation
ImageIO plugin for icon formats (ico, icl, icns)
- Host: GitHub
- URL: https://github.com/oleg-cherednik/iconmanager
- Owner: oleg-cherednik
- License: apache-2.0
- Created: 2015-07-26T10:31:38.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2021-01-05T09:23:45.000Z (almost 5 years ago)
- Last Synced: 2024-03-04T10:44:04.502Z (over 1 year ago)
- Topics: icns, ico, icon-manager, icons, imageio, java
- Language: Java
- Homepage:
- Size: 2.52 MB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://maven-badges.herokuapp.com/maven-central/ru.oleg-cherednik.icoman/icon-manager)
[](https://travis-ci.com/oleg-cherednik/IconManager)
[](https://opensource.org/licenses/Apache-2.0)
[](https://codecov.io/gh/oleg-cherednik/IconManager)
[](https://snyk.io//test/github/oleg-cherednik/IconManager?targetFile=build.gradle)
[](https://www.codacy.com/app/oleg-cherednik/IconManager?utm_source=github.com&utm_medium=referral&utm_content=oleg-cherednik/IconManager&utm_campaign=Badge_Grade)
# Icon ManagerThis is java utilite reads different icon formats to use it in the applicaitons (e.g. _Swing_), but it doesn't depend on any _Swing's_ sources).
E.g. in Swing application, usually we use png files for images. This manager provide ability to use any icon formats instead.
Currently supports:
- *.ico - Windows Icon
- *.icl - Windows Icon Library
- *.icns - Macintosh Icon
##### How do we use images in _Swing_ application
```java
JLabel label_16x16_HighColor = new JLabel(new ImageIcon("smile_16x16_HighColor.png"));
JLabel label_24x24_HighColor = new JLabel(new ImageIcon("smile_24x24_HighColor.png"));
JLabel label_32x32_HighColor = new JLabel(new ImageIcon("smile_32x32_HighColor.png"));
```
It means, that if we use lot's of different images, we have lot's of files in resources.##### How to use _Icon Manager_
- _*.ico_ and _*.icns_
```java
IconManager iconManager = IconManager.getInstance();
File file = new File("smile.ico"); // or "smile.icns"
String id = file.getName();
iconManager.addIcon(id, ImageIO.createImageInputStream(file));// get icon from the icon manager
IconFile iconFile = iconManager.getIconFile(id);JLabel label_16x16_HighColor = new JLabel(new ImageIcon(iconFile.getImage(ImageKey.parse(16, 16, 16))));
JLabel label_24x24_HighColor = new JLabel(new ImageIcon(iconFile.getImage(ImageKey.parse(24, 24, 16))));
JLabel label_32x32_HighColor = new JLabel(new ImageIcon(iconFile.getImage(ImageKey.parse(32, 32, 16))));// or use id directly in format: "x_"
JLabel label_16x16_HighColor = new JLabel(new ImageIcon(iconFile.getImage("16x16_16")));
JLabel label_24x24_HighColor = new JLabel(new ImageIcon(iconFile.getImage("24x24_16")));
JLabel label_32x32_HighColor = new JLabel(new ImageIcon(iconFile.getImage("32x32_16")));
```
- _*.icl_
This is a Windows icon library, therefore each icon has it's own name (lower-case) inside the library
```java
IconManager iconManager = IconManager.getInstance();
File file = new File("smile.icl");
String id = file.getName();
iconManager.addIcon(id, ImageIO.createImageInputStream(file));// get icon library from the icon manager
IclFile iconFile = iconManager.getIconFile(id);// get list of existed icons from the library
Set names = getNames(); // e.g. name = "Doom"
String firstIcon = names.iterator().next();JLabel label_16x16_HighColor = new JLabel(new ImageIcon(iconFile.getImage(ImageKey.parse("Doom", 16, 16, 16))));
JLabel label_24x24_HighColor = new JLabel(new ImageIcon(iconFile.getImage(ImageKey.parse("Doom", 24, 24, 16))));
JLabel label_32x32_HighColor = new JLabel(new ImageIcon(iconFile.getImage(ImageKey.parse("Doom", 32, 32, 16))));// or use id directly in format: "_x_"
JLabel label_16x16_HighColor = new JLabel(new ImageIcon(iconFile.getImage("doom_16x16_16")));
JLabel label_24x24_HighColor = new JLabel(new ImageIcon(iconFile.getImage("doom_24x24_16")));
JLabel label_32x32_HighColor = new JLabel(new ImageIcon(iconFile.getImage("doom_32x32_16")));
```
##### Links
* Home page: https://github.com/oleg-cherednik/IconManager
* Maven:
* **central:** https://mvnrepository.com/artifact/ru.oleg-cherednik.icoman/icon-manager
* **download:** http://repo1.maven.org/maven2/ru/oleg-cherednik/icoman/icon-manager/