How can I embed small images into the .class file that uses them so that I don't have to download so many separate files?
Created May 4, 2012
Sandip Chitale
Try to follow the strategy followed by the javax.swing.Icon interface. Read all about it at http://java.sun.com/products/jdk/1.2/docs/api/javax/swing/Icon.html
You can use something like this -
private static class MenuArrowIcon implements Icon, UIResource, Serializable { : : : } // End class MenuArrowIcon
from the
javax/swing/plaf/basic/BasicIconFactory.java
You can initialize an int array and use either
java.awt.image.MemoryImageSourcehttp://java.sun.com/products/jdk/1.2/docs/api/java/awt/image/MemoryImageSource.html
java.awt.image.BufferedImagehttp://java.sun.com/products/jdk/1.2/docs/api/java/awt/image/BufferedImage.html