Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Display a Quadratic formula in JavaFX using MathML in a WebView
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
public class WebViewQuadratic extends Application {
public static void main(String[] args) { Application.launch(args); }
@Override public void start(Stage primaryStage) {
WebView webView = new WebView();
"<math display=\"block\"><mrow><mi>x</mi><mo>=</mo><mfrac><mrow><mo>−</mo><mi>b</mi><mo>±</mo><msqrt><mrow><msup><mi>b</mi><mn>2</mn></msup><mo>−</mo><mn>4</mn><mi>a</mi><mi>c</mi></mrow></msqrt></mrow><mrow><mn>2</mn><mi>a</mi></mrow></mfrac></mrow></math>"
primaryStage.setScene(new Scene(webView));;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment