Hawaiʻi's Technology Community

After a month long hiatus from coding I decided to jump back in and finish a project I started a few years ago. Java has always lacked a proper icon format such as Window's
ICO and OS X's
ICNS. A modern icon format and API should support: 1. 32 bit color (ARGB) 2. Vector and bitmap images (multiple sizes for bitmaps) 3. Bundling of icon variants in a single file (active, inactive, rollover, etc.) 4. A simple to use API that supports smooth scaling, simple filters, and layering 5. Metadata Attached are the the source and binaries for a first crack API and format brilliantly named JavaIcon :-) The icon format is called JIC. A group of icons are stored in a JIC icon archive. Icon archives are zip archives with the extension ".jic" containing multiple physical icons as PNG, JPEG or SVG images. Each PNG or JPEG image has the name "image_(size).(png|jpg)" where (size) is the image size. SVG images are simply called image.svg. All images have square dimensions. Variants such as icons with drop shadows are stored within the archive in a folder named after the variant. For example, an icon variant having a drop shadow with a size of 24 should be stored as "shadow/image_24.png". Variant names are all lowercase by convention. Example internal layout of a JIC bitmap icon: image_16.png image_24.png rollover/image_16.png rollover/image_24.png disabled/image_16.png disabled/image_24.png Example internal layout of a JIC vector icon: image.svg shadow/image.svg pressed/image.svg The API is dead simple. Here are some examples: // Fetch an icon of size 24 (the icon will be automatically resized from the closest larger neighbor for bitmaps) JIconFile file = new JIconFile(iconURL); ImageIcon icon = file.getIcon(24); // Fetch an rollover version of the same icon ImageIcon icon = file.getIcon("rollover", 24); // Colorize the icon red ImageIcon redIcon = new ImageIcon(IconUtils.colorize(icon.getImage(),; The library also includes support for compositing, layering, and padding icons. // Composite the icons side by side (other layouts are available) Icon icon = new CompoundIcon(leftIcon, rightIcon); Finally, the library supports drawing simple icons using Java2D. The constructor for ShapeIcon: public ShapeIcon(Shape shape, Paint paint) {...} ShapeIcon has helper methods for basic shapes: Icon rightArrow = ShapeIcon.arrow(10, 10, ShapeIcon.RIGHT); Resizing of bitmap icons is done using bicubic interpolation for the highest quality results. The vector drawing is done using a great little library called
Salamander. I originally planned to use
Batik but its very heavy and I wanted to keep the library light. The source is distributed under the LGPL. Feel free to pull it down and take a look. As always, comments, questions and creative insults are welcome. Enjoy!

Binaries (JAR)
Source (ZIP)
Ikayzo - Design • Build • Localize | Web • Desktop • Mobile

Views: 450


You need to be a member of TechHui to add comments!

Join TechHui

Comment by Daniel Leuck on March 30, 2008 at 6:50pm
Hey David - We used Jidesoft's superb libraries extensively for a project at Bank of America. I don't know if you remember, but I brought your product into our group. Your suite is fantastic. It saved us an enormous amount of time.

Thank you for the note about IconsFactory, IconSet, and IconSetManager. I'll definitely check them out today.

So let me what you think and how we can play together to really simplify and standardize the use of icons in Java.

Absolutely! I think this should be the subject of a JSR.
Comment by David Qiao on March 30, 2008 at 6:24pm
Hi Daniel,

I have something along the line even though not exactly the same. We recently introduced a stock icon set. You can find it under The reason behind this is not just to design some nice looking icons but a suite of util classes which makes it easy to use icons in any java applications. All those classes are at JIDE Common Layer which is open sourced at Related classes are IconsFactory, IconSet, IconSetManager. There are many useful methods in IconsFactory such as get a portion of a larger icon, get rotated version, get brighten or darken or grayed version, get an icon with a small overlay icon on it etc. Then the IconSet is designed with a standard set of icons with different size. IconSetManager can be used to retrieve those icons using one line of code. If your want your application to use 24x24 icons instead of 16x16, or you want to use xp style icons for XP v.s. Vista style icons for Vista, v.s. Mac style icons for Mac OSX, it is just one line code change. So let me what you think and how we can play together to really simplify and standarize the use of icons in Java.

Comment by Daniel Leuck on March 26, 2008 at 7:28pm
Aloha Hanning. Thank you for reviewing the API.

1. any idea to support internalization. an icon is language neutral, but sometime it is culture sensitive

True. One way to handle this would be the use of icon variants named after locales. For example, to fetch the French version of an icon you would call myIconFile.getIcon("fr_FR", 16). Alternatively we could provide explicit support for locale variants by adding another argument to getIcon().

2. imageicon may be subclassed and some related logic can be moved into customized imageicon class?

I like this idea. I'll create a subclass that includes metadata.
Comment by WatchSound on March 26, 2008 at 6:57pm
Very nice and handy...
Some questions
1. any idea to support internalization. an icon is language neutal, but sometime it is culture sensitive
2. imageicon may be subclassed and some related logic can be moved into customized imageicon class?
Comment by Daniel Leuck on March 24, 2008 at 1:25pm
My TODO list for this project:
- Make the SVG renderer pluggable so Batik can be substituted for heavy rendering
- Thread the rendering
- Add XML and/or properties manifest support for metadata
- Write a tutorial
- Incorporate feedback
- Possibly port to other platforms (.NET, etc.)


web design, web development, localization

© 2019   Created by Daniel Leuck.   Powered by

Badges  |  Report an Issue  |  Terms of Service