Skip to content

Instantly share code, notes, and snippets.

@TomasMikula
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TomasMikula/13ebd2c1e1dfcb7d4a8a to your computer and use it in GitHub Desktop.
Save TomasMikula/13ebd2c1e1dfcb7d4a8a to your computer and use it in GitHub Desktop.
[RT-36130] NPE at javafx.scene.text.Text.getSpanBounds(Text.java:292)
apply plugin: 'java'
apply plugin: 'application'
sourceCompatibility = '1.8'
mainClassName = 'Main'
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
dependencies {
compile "org.jfxtras:jfxtras-labs:8.0-r2-SNAPSHOT"
}
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;
import jfxtras.labs.scene.control.window.Window;
import jfxtras.labs.scene.layout.ScalableContentPane;
public class Main extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
ScalableContentPane root = new ScalableContentPane();
Scene scene = new Scene(root, 800, 600);
TextFlow textFlow = new TextFlow(new Text("The Code"));
Window w = new Window("Editor");
w.getContentPane().getChildren().add(textFlow);
root.getContentPane().getChildren().add(w);
primaryStage.setScene(scene);
primaryStage.show();
}
}
@TomasMikula
Copy link
Author

Download both files and place Main.java under src/main/java.

Run gradle run to execute.

@TomasMikula
Copy link
Author

This gist is the sample code to reproduce RT-36130.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment