ImageIcon
でファイルを保存できるかどうか知っている人はいますObjectOutputStream
か? 私は で保存する人物登録を持っているので、その情報と一緒にObjectOutputStream
を書くと非常に便利です。imageicon
しかし、画像アイコンを読み取ろうとしても何も起こりません。他のすべての情報を読むことができますが、取得できないようですImageIcon
。
誰か私に何ができるかについてのアイデアはありますか?
編集:私は人物クラスと人物登録クラスを持っています。以下は person クラスで、personregistry クラスは複数の person の集まりです。オブジェクト出力ストリームを使用して個人登録を書き出します。
public Person(String fn, String en, String a, int t, ImageIcon kb, Kort k) {
fname= fn;
lname= en;
adress= a;
tlf= t;
card= k;
df.format(medlemsNr= ++nextNr);
cardPicture= kb;
neste= null;
}
public void writePersonsToFile() {
try(ObjectOutputStream utfil= new ObjectOutputStream(
new FileOutputStream(("PersonRegistry.data")))) {
utfil.writeObject(personRegistry);
}
catch(NotSerializableException nse) {
}
catch(IOException ioe) {
}
}