for all those who google
for a solution of Streaming imageIcons in Java. I had problems, the images where lost. google words: Java Serialization ImageIcon Bug Bugfix Problem
// serialization
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeObject(smallIcon);
}
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
smallIcon = (ImageIcon)in.readObject();
if (smallIcon!= null)
smallIcon = new ImageIcon(smallIcon.getImage());
}
// serialization
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
out.writeObject(smallIcon);
}
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
smallIcon = (ImageIcon)in.readObject();
if (smallIcon!= null)
smallIcon = new ImageIcon(smallIcon.getImage());
}
leobard - 17. Aug, 12:47
|
- add comment - 0 trackbacks
Trackback URL:
https://leobard.twoday.net/stories/304578/modTrackback