Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8124377

TextAilgnment is not applied to the text node

XMLWordPrintable

      import com.sun.javafx.runtime.VersionInfo;
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.scene.layout.StackPane;
      import javafx.scene.layout.VBox;
      import javafx.scene.text.Text;
      import javafx.stage.Stage;

      public class Main extends Application {

          public static void main(String[] args) {
              launch(args);
          }

          @Override
          public void start(Stage stage) throws Exception {
              stage.setTitle(VersionInfo.getRuntimeVersion());
              stage.setScene(createScene());
              stage.show();
          }

          private Scene createScene() {
              StackPane root = new StackPane();
              
              final Text text = new Text("Test test test");
              String style = "-fx-text-alignment:right;-fx-border-color:red;";
              text.setStyle(style);
             
              VBox v = new VBox(5);
              v.setFillWidth(true);
              v.setMinWidth(200);
              v.setStyle("-fx-border-color:green");
              
              v.getChildren().addAll(text, new Label("Text"));
              
              Scene s = new Scene(v);
              return s;
          }
      }

            fheidric Felipe Heidrich (Inactive)
            dzinkevi Dmitry Zinkevich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: