Javaを使用してシミュレーションソフトウェアをプログラミングしています。ダブルバッファリングでペイントするフレームがあります。以下は、コンストラクターでそれを行う方法です。
repaintmanager = new UnRepaintManager();
repaintmanager.setDoubleBufferingEnabled(false);
RepaintManager.setCurrentManager(repaintmanager);
JFileChooser を作成したい:
else if(e.getSource()==sendPhotoToAll)
{
System.out.println("11111111111111");
chooser.setDialogTitle("Choose Photo");
//the "this" in the below code is the JFrame that acts as the
//parent to the JFileChooser dialog.
int retval = chooser.showOpenDialog(BattleZoneTest.this);
System.out.println(retval);
if (retval == JFileChooser.APPROVE_OPTION) {
//... The user selected a file, get it, use it.
File file = chooser.getSelectedFile();
}
}
ファイル チューザーがポップアップしますが、何も実行できません。コンストラクターで repaintManager の直前にランダムな JFileChooser を作成しようとすると、チューザーは問題なく期待どおりに機能します。filechooser に対する repaint manager の効果は何ですか? どうすれば修正できますか?前もって感謝します!!!