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

[ToggleButton] focusTraversable can't be disabled

XMLWordPrintable

      Setting the property to false doesn't change anything.
      This behavior appears in publicly released ea b10 and ea b11. It worked fine in ea b05.

      Sadly, I can't think of any workaround, so I'll have to downgrade back to b05 as it breaks my application's functionality.

      Code to reproduce:

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.ToggleButton;
      import javafx.scene.control.ToggleGroup;
      import javafx.scene.layout.HBox;
      import javafx.stage.Stage;

      public class ToggleButtonFocus extends Application
      {

      @Override
      public void start(final Stage stage) throws Exception
      {
      final ToggleGroup tg = new ToggleGroup();
      final ToggleButton tb1 = createToggle("red");
      final ToggleButton tb2 = createToggle("blue");
      tb1.setToggleGroup(tg);
      tb2.setToggleGroup(tg);
      tg.selectToggle(tb1);
      stage.setScene(new Scene(new HBox(tb1, tb2)));
      stage.show();
      }

      private static ToggleButton createToggle(final String title)
      {
      final ToggleButton t = new ToggleButton(title);
      t.setFocusTraversable(false);
      t.setPrefWidth(100);
      return t;
      }

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

      }

            msladecek Martin Sládeček
            jsmucrjfx Jan Smucr (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: