Created
February 9, 2012 00:25
Display a Quadratic formula in JavaFX using MathML in a WebView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
webView.getEngine().loadContent( | |
"<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)); | |
primaryStage.show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment