org.pushingpixels.substance.api.UiThreadingViolationException: Component creation must be done on Event Dispatch Thread

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@12038 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Konstantin Zolotarev
2011-02-26 08:04:57 +00:00
committed by konstantin.zolotarev
parent 887ee46e08
commit a6acdbaab2

View File

@ -19,11 +19,13 @@
*/
package org.jivesoftware.spark.plugin.flashing;
import java.awt.EventQueue;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
import org.jivesoftware.spark.preference.Preference;
import org.jivesoftware.spark.util.log.Log;
public class FlashingPreference implements Preference {
public static String NAMESPACE = "flashing";
@ -32,7 +34,22 @@ public class FlashingPreference implements Preference {
public FlashingPreference() {
preferences = new FlashingPreferences();
try {
if (EventQueue.isDispatchThread()) {
dialog = new FlashingPreferenceDialog();
} else {
EventQueue.invokeAndWait(new Runnable()
{
@Override
public void run()
{
dialog = new FlashingPreferenceDialog();
}
});
}
} catch (Exception e) {
Log.error(e);
}
}
public FlashingPreferences getPreferences() {