Fix bug that with setStroke that fails in windows.

Add check for older versions of Java.
This commit is contained in:
Chris Cromer 2017-07-24 23:05:22 -04:00 committed by Chris Cromer
parent 7855e074d4
commit 0cee7626ad
3 changed files with 21 additions and 11 deletions

View File

@ -22,9 +22,9 @@
<b>The webstart and embedded verions require java 8 to run! It is also necessary to add cromer.cl to your
trusted sites in java settings because the java applet is unsigned.</b><br>
<hr>
<b>Windows:</b> <a href='MT-1.0.0.zip'>click to download windows binary</a><br>
<b>Windows:</b> <a href='MT-1.0.1.zip'>click to download windows binary</a><br>
<hr>
<b>Linux:</b> <a href='MT-1.0.0.tar.gz'>click to download linux binary</a><br>
<b>Linux:</b> <a href='MT-1.0.1.tar.gz'>click to download linux binary</a><br>
<hr>
<b>Webstart:</b> <a href='MT.jnlp' onclick="return launchApplication('MT.jnlp');">click to launch this app as
webstart</a><br>

View File

@ -116,7 +116,7 @@ public class IndividualController extends VBox {
rectangle.setId("caja_" + label);
Text text = new Text();
text.setId("simbolo_" + label);
text.setStroke(Color.BLACK);
text.setFill(Color.BLACK);
text.setText(texto);
StackPane stackPane = new StackPane();
@ -146,7 +146,7 @@ public class IndividualController extends VBox {
Rectangle rectangle = (Rectangle) scene.lookup("#caja_1");
rectangle.setFill(Color.BLUE);
Text simbolo = (Text) scene.lookup("#simbolo_1");
simbolo.setStroke(Color.WHITE);
simbolo.setFill(Color.WHITE);
cadena.setText("");
cadena.setDisable(true);
@ -223,13 +223,13 @@ public class IndividualController extends VBox {
Rectangle rectangle = (Rectangle) scene.lookup("#caja_" + cabezalAnterior);
rectangle.setFill(Color.WHITE);
Text simbolo = (Text) scene.lookup("#simbolo_" + cabezalAnterior);
simbolo.setStroke(Color.BLACK);
simbolo.setFill(Color.BLACK);
// Cabezel
rectangle = (Rectangle) scene.lookup("#caja_" + maquina.getCabezal());
rectangle.setFill(Color.BLUE);
simbolo = (Text) scene.lookup("#simbolo_" + maquina.getCabezal());
simbolo.setStroke(Color.WHITE);
simbolo.setFill(Color.WHITE);
cabezalAnterior = maquina.getCabezal();
estadoPrevio = maquina.getEstadoActual().getQ();

View File

@ -11,10 +11,9 @@ import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.layout.Region;
import javafx.stage.Stage;
/**
@ -22,13 +21,13 @@ import javafx.stage.Stage;
*
* @author Christopher Cromer
* @author Carlos Fáundez
* @version 1.0.0
* @version 1.0.1
*/
public class MT extends Application {
/**
* La version de Maquina de Turing
*/
static public final String version = "1.0.0";
static public final String version = "1.0.1";
/**
* El metodo principal del programa
@ -72,5 +71,16 @@ public class MT extends Application {
primaryStage.setMinWidth(640);
primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/cl/cromer/mt/images/icon.png")));
primaryStage.show();
if (Double.valueOf(System.getProperty("java.specification.version")) < 1.8) {
ButtonType botonCerrar = new ButtonType("Cerrar", ButtonBar.ButtonData.OK_DONE);
Alert alert = new Alert(Alert.AlertType.NONE, "El programa se necesita Java 8 para correr.");
alert.getDialogPane().getChildren().stream().filter(node -> node instanceof Label).forEach(node -> ((Label) node).setMinHeight(Region.USE_PREF_SIZE));
alert.setGraphic(null);
alert.getDialogPane().getButtonTypes().add(botonCerrar);
Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getIcons().add(new Image(getClass().getResourceAsStream("/cl/cromer/mt/images/icon.png")));
alert.showAndWait();
primaryStage.close();
}
}
}