* Fixed client crush on old systems without JavaFX supports like MacOS 10.9;

This commit is contained in:
Oleg Agafonov 2019-04-02 08:20:48 +04:00
parent 3e18305890
commit b7e68f3e0a
4 changed files with 18 additions and 8 deletions

View file

@ -93,7 +93,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
private static MageFrame instance;
private final ConnectDialog connectDialog;
private final WhatsNewDialog whatsNewDialog;
private WhatsNewDialog whatsNewDialog; // can be null
private final ErrorDialog errorDialog;
private static CallbackClient callbackClient;
private static final Preferences PREFS = Preferences.userNodeForPackage(MageFrame.class);
@ -246,7 +246,15 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
SessionHandler.startSession(this);
callbackClient = new CallbackClientImpl(this);
connectDialog = new ConnectDialog();
whatsNewDialog = new WhatsNewDialog();
try
{
whatsNewDialog = new WhatsNewDialog();
} catch (NoClassDefFoundError e) {
// JavaFX is not supported on old MacOS with OpenJDK
// https://bugs.openjdk.java.net/browse/JDK-8202132
LOGGER.error("JavaFX is not supported by your system. What's new page will be disabled.", e);
whatsNewDialog = null;
}
desktopPane.add(connectDialog, JLayeredPane.MODAL_LAYER);
errorDialog = new ErrorDialog();
errorDialog.setLocation(100, 100);
@ -336,7 +344,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
// run what's new checks (loading in background)
SwingUtilities.invokeLater(() -> {
whatsNewDialog.checkUpdatesAndShow(false);
showWhatsNewDialog(false);
});
}
@ -1578,8 +1586,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
addTooltipContainer();
}
public WhatsNewDialog getWhatsNewDialog() {
return whatsNewDialog;
public void showWhatsNewDialog(boolean forceToShowPage) {
if (whatsNewDialog != null) {
whatsNewDialog.checkUpdatesAndShow(forceToShowPage);
}
}
}

View file

@ -136,7 +136,7 @@ public class AboutDialog extends MageDialog {
}//GEN-LAST:event_btnOkActionPerformed
private void btnWhatsNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnWhatsNewActionPerformed
MageFrame.getInstance().getWhatsNewDialog().checkUpdatesAndShow(true);
MageFrame.getInstance().showWhatsNewDialog(true);
}//GEN-LAST:event_btnWhatsNewActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables

View file

@ -794,7 +794,7 @@ public class ConnectDialog extends MageDialog {
}//GEN-LAST:event_btnCheckStatusActionPerformed
private void btnWhatsNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnWhatsNewActionPerformed
MageFrame.getInstance().getWhatsNewDialog().checkUpdatesAndShow(true);
MageFrame.getInstance().showWhatsNewDialog(true);
}//GEN-LAST:event_btnWhatsNewActionPerformed
private void doFastFlagSearch() {

View file

@ -1600,7 +1600,7 @@ public class TablesPanel extends javax.swing.JPanel {
}//GEN-LAST:event_btnFormatVintageActionPerformed
private void buttonWhatsNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonWhatsNewActionPerformed
MageFrame.getInstance().getWhatsNewDialog().checkUpdatesAndShow(true);
MageFrame.getInstance().showWhatsNewDialog(true);
}//GEN-LAST:event_buttonWhatsNewActionPerformed
private void handleError(Exception ex) {