こんにちは私は描画するjpanelを持っています。このjpanelから、バッファリングされたイメージを作成し、それらをリンクリストに安全にします。ボタンを押すと、このバッファリングされた画像をアニメーション化します(1つずつ再生します)問題は、jpanelがバッファリングされた画像を表示しないことですが、ImageIO.writeを使用してディスク上のバッファリングされた画像を保護すると、アニメーション化するすべての画像が表示されます。plsは私を助けます。
これが私のコードです:
public void run(){
for(int i=0;i`<`cm.animationListe.size();i++){
b= cm.animationListe.get(i);
try {
ImageIO.write( b, "png", new File( "c:/java/circle"+i+".png" ) );
} catch (IOException e1) {
e1.printStackTrace();
}
try {
Thread.sleep(1000);
repaint();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}}
animation = false;
}
public void paintComponent(Graphics g){
super.paintComponent(g);
if(animation){
g.drawImage(b,0, 0,null);
}
}