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

ChoiceBox sometimes doesn't display content after new items are set

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Incomplete
    • Affects Version/s: 7u15
    • Fix Version/s: 8u20
    • Component/s: javafx
    • Labels:
    • Environment:

      Java 7 update 15 x32, Win 8 x64
      JavaFX version: the one in Java 7 u15 (I think it's 2.2.7, but I don't remember)

      Description

      This bug happens very seldom.
      Basically, sometimes it doesn't display the items.
      Please check the attachment before reading the steps. You will see a ChoiceBox displayed very strange.

      Steps:
      1.
      // This ChoiceBox is called Mål in the screenshot. It belongs to left tab "Del B" from parent tab "Forløb".
      @FXML private ChoiceBox<ProgressGoal> goalCB;
      goalCB.setItems(new ObservableListWrapper<>(myList));

      ProgressGoal entity class content summary:
      private Integer id;
      private Progress progress;
      private Progress.Category category;
      private String name;
      // Getters and setters
      @Override
      public String toString() {
      return name;
      }

      2.
      I do modify some data in left tab "Målene", then I run the following code to update the items from my ChoiceBox:
      int previousSelectedIndex = goalCB.getSelectionModel().getSelectedIndex();
      // Creates an empty list to trigger the change
      goalCB.setItems(new ObservableListWrapper<>(new LinkedList<ProgressGoal>()));
      goalCB.setItems(new ObservableListWrapper<>(cepc.getProgress().getGoals()));
      // Clears before to trigger the change
      goalCB.getSelectionModel().clearSelection();
      goalCB.getSelectionModel().select(previousSelectedIndex);

      3.
      After that, but very seldom, the items don't appear when I click the ChoiceBox.
      It looks like in the screenshot. It appears a very small thing.
      If I put the mouse over that small little circle (or whatever), then the items are displayed.

      I hope this can help to identify the bug.
      I will upload the screenshot in a comment, because the "Create issue" pop-up doesn't allow this feature.

        Attachments

          Activity

            People

            Assignee:
            jgiles Jonathan Giles
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: