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?

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.MemoryImageSource
http://java.sun.com/products/jdk/1.2/docs/api/java/awt/image/MemoryImageSource.html

java.awt.image.BufferedImage
http://java.sun.com/products/jdk/1.2/docs/api/java/awt/image/BufferedImage.html
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact