Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Cannot disable javafx.scene.text.Text

cshAug 26 2016 — edited Sep 1 2016

Hi.

I want to disable javafx.scene.text.Text in a Scene. These texts are contained in a TextFlow.

However, the Texts are not displayed as disabled (unlike Label). If I add javafx.scene.control.Label to the TextFlow instead, they are displayed gray (disabled).

How can I achieve the same visual representation with Texts (displaying it gray / opaque, when disabled)?

import javafx.application.Application;

import javafx.scene.Scene;

import javafx.scene.text.Text;

import javafx.scene.text.TextFlow;

import javafx.stage.Stage;

public class TestApp extends Application {

   public static void main(String[] args) {

   launch(args);

  }

   @Override
   public void start(final Stage stage) throws Exception {

  TextFlow textFlow = new TextFlow();

  textFlow.getChildren().add(new Text("test"));

  textFlow.disableProperty().set(true);

  Scene scene = new Scene(textFlow);

  stage.setScene(scene);

  stage.show();

  }

}

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Sep 29 2016
Added on Aug 26 2016
2 comments
605 views