public static void doImageCahce(JEditorPane edit) {
try {
Dictionary cache = (Dictionary) edit.getDocument().getProperty("imageCache");
if (cache == null) {
cache = new Hashtable();
edit.getDocument().putProperty("imageCache", cache);
}
List
ImageIcon icon1 = UIStorage.getImageCollectionBean().get("1.png");
icons.add(icon1);
ImageIcon icon2 = UIStorage.getImageCollectionBean().get("2.png");
icons.add(icon2);
ImageIcon icon3 = UIStorage.getImageCollectionBean().get("3.jpg");
icons.add(icon3);
ImageIcon icon4 = UIStorage.getImageCollectionBean().get("4.png");
icons.add(icon4);
for (ImageIcon imageIcon : icons) {
URL u = new URL(imageIcon.toString());
cache.put(u, imageIcon.getImage());
}
} catch (MalformedURLException e) {
e.printStackTrace();
}