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

Tab is visually not disabled, when setting disable(true) at creation time

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P4
    • Resolution: Fixed
    • 8
    • 8
    • javafx

    Description

      Setting the DisableProperty has no effect in creation time. (CSS-state :disabled is ignored)
      While running a program, it is works fine.

      See Example:

      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.Tab;
      import javafx.scene.control.TabPane;
      import javafx.scene.layout.BorderPane;
      import javafx.stage.Stage;

      public class TabTestApp extends Application {

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

          @Override
          public void start(Stage primaryStage) throws Exception {
              BorderPane pane = new BorderPane();
              
              TabPane tabPane = new TabPane();
              Tab tab1 = new Tab("Tab 1 (disabled)");
              tab1.setDisable(true);
              tabPane.getTabs().add(tab1);
              final Tab tab2 = new Tab("Tab 2");
              tabPane.getTabs().add(tab2);
              pane.setTop(tabPane);
              
              Button btn = new Button("disable/enable Tab 2");
              btn.setOnAction(new EventHandler<ActionEvent>() {
                  @Override
                  public void handle(ActionEvent event) {
                      tab2.setDisable(!tab2.isDisable());
                  }
              });
              pane.setBottom(btn);
              
              Scene scene = new Scene(pane, 500, 200);

              primaryStage.setScene(scene);
              primaryStage.show();

          }
      }

      Attachments

        Activity

          People

            jgiles Jonathan Giles
            czillmannjfx Claudine Zillmann (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: