issue with Ensemble ListCellFactory example when using a few fields

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 8
    • Component/s: javafx
    • Environment:

      Java 8 build 84 Netbeans Lambda 8, Windows 7 64-bit

      I checked out the Emsemble example for creating your own Cell Factory and it all worked until I took their example of lets say 20 numbers(which allowed for a scroll) and turned it into 3. For some reason when I would run it and run my mouse cursor over the first row in and focus in/out it would turn the cell invisible, then display it...


      final ListView<Number> listView = new ListView<>();
              listView.setItems(FXCollections.<Number>observableArrayList(
                      100.00, -12.34, 33.01
              ));
               
              listView.setCellFactory((ListView<java.lang.Number> list) -> new moneyViewer());
               
            // listView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
              
              
           
      Group root = new Group(listView);


       class moneyViewer extends ListCell<Number>
       {
              @Override
              public void updateItem(Number item, boolean empty)
              {
                  super.updateItem(item, empty);
                   
                  // format the number as if it were a monetary value using the
                  // formatting relevant to the current locale. This would format
                  // 43.68 as "$43.68", and -23.67 as "($23.67)"
                  setText(item == null ? "" : NumberFormat.getCurrencyInstance().format(item));
       
                  if (item != null) {
                      double value = item.doubleValue();
                      
                      setTextFill(value == 0 ? Color.BLACK :
                          value < 0 ? Color.RED : Color.GREEN);
                  }
              }
          }

            Assignee:
            Unassigned
            Reporter:
            Jay Orsaw (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Imported: