-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NPE at javafx.scene.text.Text.getSpanBounds(Text.java:292) #15
Comments
Can you please post the full code, so that I can try it out? For example, I don't know where |
I'll setup a small project to demonstrate the issue. |
Seems to be related to the ScalableContentPane. I haven't had any issues with applying scale transformations to controls so far. How To Reproduce: Before running it, call the Use the Here's the code: https://gist.github.com/miho/9322527 Can you reproduce it? |
Thanks for the sample code. Seems to be a TextFlow problem. This is how I changed your code (leaving out CodeArea altogether): import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;
import jfxtras.labs.scene.control.window.CloseIcon;
import jfxtras.labs.scene.control.window.Window;
import jfxtras.labs.scene.layout.ScalableContentPane;
public class Main extends Application {
/**
* The main() method is ignored in correctly deployed JavaFX application.
* main() serves only as fallback in case the application can not be
* launched through deployment artifacts, e.g., in IDEs with limited FX
* support. NetBeans ignores main().
*
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
// indicates whether to use a scalable content pane
boolean withScalableContentPane = true;
// setup scene
Pane canvas;
Scene scene;
if (withScalableContentPane) {
ScalableContentPane root = new ScalableContentPane();
canvas = root.getContentPane();
scene = new Scene(root, 800, 600);
} else {
canvas = new Pane();
scene = new Scene(canvas, 800, 600);
}
// add a window that contains a TextFlow
TextFlow textFlow = new TextFlow(new Text("The Code"));
Window w = new Window("Editor");
w.getLeftIcons().add(new CloseIcon(w));
w.setPrefSize(400, 300);
w.getContentPane().getChildren().add(textFlow);
canvas.getChildren().add(w);
// show the stage
primaryStage.setTitle("Demo!");
primaryStage.setScene(scene);
primaryStage.show();
}
} When I run this, I actually get an infinite loop of exceptions. Another observation I made is that the combination of ScalableContentPane and Window is required to reproduce the bug. Adding the TextFlow (or CodeArea) directly to I'm going to close this. When the problem with TextFlow is fixed and the problem with CodeArea does not go away, please reopen. |
Thanks for your response! I found a workaround for the
Unfortunately this does not work for |
I reported this to OpenJFX: RT-36130. |
Thanks! |
Unfortunately, the CodeArea still does not work with the ScalableContentPane. With 8u20 the error is different:
I'd love to use RichTextFX for my JavaOne Live Demos. Any ideas? Note: it works with TextFlow |
Is this with the latest 0.4.2 version? |
0.4.2 and 1.0-SNAPSHOT |
Hi Michael, I did some digging and the following might be the cause of this exception, but certainly is a bug in JFXtras' Window.
However, Window.java sets |
Thanks for this hint! Looks like we produce event garbage in the window control. |
It works! Thanks again. Just in case anybody else is having this issue: use the window control from jfxtras-window instead of the one from jfxtras-labs. It does not have the issue mentioned by Tomas. |
Just tried to use the CodeArea inside a JFXtras-labs 8 window control. Unfortunately I get the following error:
JavaFX
TextArea
andText
nodes do work.The error does not occur if I prevent layout calls via
setManaged(false)
.What I do exactly:
I'm testing on OS X, JDK 8-b129 and the CodeAreaFX from commit
b8846ca3e1fba8e4829ee3d015b305b2bf99380c
The text was updated successfully, but these errors were encountered: