.addActionListener(new ActionListener(){
public void actionPerformed (ActionEvent e){
try{
ta.append("Searching Initiated at: "+datetime()+"\n");
gui.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
task.execute();
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
gui.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
});
//Enable the next stage in the YD process and disable the previously executed functions
clusAn.setEnabled(true);
open.setEnabled(false);
statCl.setEnabled(false);
}catch (Exception IOE){
}
}
});
こんにちは、私が設計したこのアプリケーションの最終段階で少し苦労しています。
基本的に、ユーザーがボタンをクリックすると、カーソルが「待機中」のバージョンになり、バックグラウンド プロセス (task.execute) が完了すると、カーソルが通常に戻るようにしたいと思います。
task.execute は同じクラスにないため、GUI を変数として認識しないため、「gui.setCursor」を直接呼び出すことはできません。
どうしたらいいのかわからないのでアドバイスいただけると助かります
ありがとう