Browse Source

Fix bug that with setStroke that fails in windows.

Add check for older versions of Java.
Chris Cromer 1 year ago
parent
commit
0cee7626ad
3 changed files with 21 additions and 11 deletions
  1. 2
    2
      index.html
  2. 4
    4
      src/cl/cromer/mt/IndividualController.java
  3. 15
    5
      src/cl/cromer/mt/MT.java

+ 2
- 2
index.html View File

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

+ 4
- 4
src/cl/cromer/mt/IndividualController.java View File

@@ -116,7 +116,7 @@ public class IndividualController extends VBox {
116 116
 		rectangle.setId("caja_" + label);
117 117
 		Text text = new Text();
118 118
 		text.setId("simbolo_" + label);
119
-		text.setStroke(Color.BLACK);
119
+		text.setFill(Color.BLACK);
120 120
 		text.setText(texto);
121 121
 
122 122
 		StackPane stackPane = new StackPane();
@@ -146,7 +146,7 @@ public class IndividualController extends VBox {
146 146
 		Rectangle rectangle = (Rectangle) scene.lookup("#caja_1");
147 147
 		rectangle.setFill(Color.BLUE);
148 148
 		Text simbolo = (Text) scene.lookup("#simbolo_1");
149
-		simbolo.setStroke(Color.WHITE);
149
+		simbolo.setFill(Color.WHITE);
150 150
 
151 151
 		cadena.setText("");
152 152
 		cadena.setDisable(true);
@@ -223,13 +223,13 @@ public class IndividualController extends VBox {
223 223
 				Rectangle rectangle = (Rectangle) scene.lookup("#caja_" + cabezalAnterior);
224 224
 				rectangle.setFill(Color.WHITE);
225 225
 				Text simbolo = (Text) scene.lookup("#simbolo_" + cabezalAnterior);
226
-				simbolo.setStroke(Color.BLACK);
226
+				simbolo.setFill(Color.BLACK);
227 227
 
228 228
 				// Cabezel
229 229
 				rectangle = (Rectangle) scene.lookup("#caja_" + maquina.getCabezal());
230 230
 				rectangle.setFill(Color.BLUE);
231 231
 				simbolo = (Text) scene.lookup("#simbolo_" + maquina.getCabezal());
232
-				simbolo.setStroke(Color.WHITE);
232
+				simbolo.setFill(Color.WHITE);
233 233
 
234 234
 				cabezalAnterior = maquina.getCabezal();
235 235
 				estadoPrevio = maquina.getEstadoActual().getQ();

+ 15
- 5
src/cl/cromer/mt/MT.java View File

@@ -11,10 +11,9 @@ import javafx.application.Application;
11 11
 import javafx.fxml.FXMLLoader;
12 12
 import javafx.scene.Parent;
13 13
 import javafx.scene.Scene;
14
-import javafx.scene.control.ButtonBar;
15
-import javafx.scene.control.ButtonType;
16
-import javafx.scene.control.Dialog;
14
+import javafx.scene.control.*;
17 15
 import javafx.scene.image.Image;
16
+import javafx.scene.layout.Region;
18 17
 import javafx.stage.Stage;
19 18
 
20 19
 /**
@@ -22,13 +21,13 @@ import javafx.stage.Stage;
22 21
  *
23 22
  * @author Christopher Cromer
24 23
  * @author Carlos Fáundez
25
- * @version 1.0.0
24
+ * @version 1.0.1
26 25
  */
27 26
 public class MT extends Application {
28 27
 	/**
29 28
 	 * La version de Maquina de Turing
30 29
 	 */
31
-	static public final String version = "1.0.0";
30
+	static public final String version = "1.0.1";
32 31
 
33 32
 	/**
34 33
 	 * El metodo principal del programa
@@ -72,5 +71,16 @@ public class MT extends Application {
72 71
 		primaryStage.setMinWidth(640);
73 72
 		primaryStage.getIcons().add(new Image(getClass().getResourceAsStream("/cl/cromer/mt/images/icon.png")));
74 73
 		primaryStage.show();
74
+		if (Double.valueOf(System.getProperty("java.specification.version")) < 1.8) {
75
+			ButtonType botonCerrar = new ButtonType("Cerrar", ButtonBar.ButtonData.OK_DONE);
76
+			Alert alert = new Alert(Alert.AlertType.NONE, "El programa se necesita Java 8 para correr.");
77
+			alert.getDialogPane().getChildren().stream().filter(node -> node instanceof Label).forEach(node -> ((Label) node).setMinHeight(Region.USE_PREF_SIZE));
78
+			alert.setGraphic(null);
79
+			alert.getDialogPane().getButtonTypes().add(botonCerrar);
80
+			Stage stage = (Stage) alert.getDialogPane().getScene().getWindow();
81
+			stage.getIcons().add(new Image(getClass().getResourceAsStream("/cl/cromer/mt/images/icon.png")));
82
+			alert.showAndWait();
83
+			primaryStage.close();
84
+		}
75 85
 	}
76 86
 }

Loading…
Cancel
Save