I have an InlineCssTextArea where I append a line of text and then attempt to center the entire paragraph. I've tried setting the setParagraphStyle and setStyle, but neither seems to work. I've attached a sample that shows the behavior, any ideas where I might be going wrong?
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import org.fxmisc.richtext.InlineCssTextArea;
public class Example extends Application {
public static void main(String args[]){
launch(Example.class);
}
@Override
public void start(Stage primaryStage) throws Exception {
GridPane root = new GridPane();
Scene scene = new Scene(root, 900.0,900.0);
InlineCssTextArea area = new InlineCssTextArea();
root.add(area, 0, 5, 4, 1);
primaryStage.setTitle("Example");
primaryStage.setScene(scene);
primaryStage.show();
area.appendText("Test");
area.setParagraphStyle(area.getCurrentParagraph(), "-fx-text-align: center;");
area.setStyle(area.getCurrentParagraph(), "-fx-text-align: center;");
}
}
I have an InlineCssTextArea where I append a line of text and then attempt to center the entire paragraph. I've tried setting the
setParagraphStyleandsetStyle, but neither seems to work. I've attached a sample that shows the behavior, any ideas where I might be going wrong?