desktop: don't show dialogs when headless

experimental^2^2
Kirill Vainer 9 years ago
parent 80af02e1f3
commit 239524c85b
  1. 20
      jme3-desktop/src/main/java/com/jme3/system/JmeDesktopSystem.java

@ -43,6 +43,7 @@ import com.jme3.system.JmeContext.Type;
import com.jme3.util.Screenshots;
import java.awt.EventQueue;
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
import java.awt.RenderingHints;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
@ -116,12 +117,16 @@ public class JmeDesktopSystem extends JmeSystemDelegate {
@Override
public void showErrorDialog(String message) {
final String msg = message;
EventQueue.invokeLater(new Runnable() {
public void run() {
ErrorDialog.showDialog(msg);
}
});
if (!GraphicsEnvironment.isHeadless()) {
final String msg = message;
EventQueue.invokeLater(new Runnable() {
public void run() {
ErrorDialog.showDialog(msg);
}
});
} else {
System.err.println("[JME ERROR] " + message);
}
}
@Override
@ -129,6 +134,9 @@ public class JmeDesktopSystem extends JmeSystemDelegate {
if (SwingUtilities.isEventDispatchThread()) {
throw new IllegalStateException("Cannot run from EDT");
}
if (GraphicsEnvironment.isHeadless()) {
throw new IllegalStateException("Cannot show dialog in headless environment");
}
final AppSettings settings = new AppSettings(false);
settings.copyFrom(sourceSettings);

Loading…
Cancel
Save