JDK-8087902 : TableView odd/even row background flickers during update
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: 8
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2013-03-29
  • Updated: 2018-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
When I'm updating the data in my TableView I see the background of the cells flip their odd/even row background color leading to a very distracting flicker, specially for tables that are constantly updating.
The odd thing is that the color toggle seems to start on row 2 so the table draws with two adjacent rows with the same background color during the update as the odd/even phase flips between those rows.
Comments
@Scott: Honestly, I don't know. To me retargeting to Van Ness is more about saying this is not being targeted to Lombard anymore, as opposed to specifically targeting to the next major JavaFX release. Ideally I would fix this in a 8.x or 8.x.y release instead. The big reason for the retargeting was because time is not on my side, and honestly whilst I agree this isn't a great bug I think it has to fall down the stack compared to some of the other more critical issues on my plate. Having said that, I am always very happy to receive patches! :-)
18-09-2013

:( What is the scheduled release timeframe for Van Ness?
18-09-2013

i can confirm this behavior. JavaFX8 only (for me) b105. - the flicker doesnt happen when first row of the table is visible (scrollbar completely up) i am also overriding selection model of the table in MouseEvents (Pressed,Released,Dragged) by reselecting some items to achieve certain functionality, and with the flicker i also see the 'old' selected items flicker or something like that im not sure now.
08-09-2013

Just captured a video of this running my app on JavaFX 8.0-b92 http://www.screencast.com/t/1MJmXKzj
09-06-2013

I should mention that the flicker doesn't happen with 2.2.7
04-04-2013

package tableflicker; import java.util.ArrayList; import java.util.List; import java.util.Objects; import javafx.application.Application; import javafx.beans.property.DoubleProperty; import javafx.beans.property.SimpleDoubleProperty; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.control.Slider; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; /** * * @author scott.palmer */ public class TableFlicker extends Application { public static class Item { public Item(String name, Double value) { this.name = name; this.value.setValue(value); } public String getName() { return name; } public DoubleProperty valueProperty() { return value; } public Double getValue() { return value.getValue(); } public void setValue(Double d) { value.setValue(d); } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Item other = (Item) obj; if (!Objects.equals(this.name, other.name)) { return false; } if (!Objects.equals(this.value, other.value)) { return false; } return true; } @Override public int hashCode() { int hash = 3; hash = 89 * hash + Objects.hashCode(this.name); hash = 89 * hash + Objects.hashCode(this.value); return hash; } String name = ""; SimpleDoubleProperty value = new SimpleDoubleProperty(); } private Item selected; @Override public void start(Stage primaryStage) { final ObservableList<Item> items = FXCollections.observableArrayList(); for (int i = 0; i < 30; i++) { items.add(new Item(String.valueOf((char)('A'+i)), (double)i)); } final TableView<Item> table = new TableView(); table.setItems(items); table.setMinHeight(64); table.setPrefHeight(100); table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); TableColumn<Item, String> nameCol = new TableColumn<>("Name"); TableColumn<Item, Double> valCol = new TableColumn<>("Value"); table.getColumns().addAll(nameCol,valCol); nameCol.setCellValueFactory(new PropertyValueFactory<Item, String>("name")); valCol.setCellValueFactory(new PropertyValueFactory<Item, Double>("value")); table.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Item>() { @Override public void changed(ObservableValue<? extends Item> ov, Item t, Item t1) { if (t1 != null) selected = t1; } }); Slider valueSlider = new Slider(0, 100, 50); valueSlider.valueProperty().addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> ov, Number t, Number t1) { if (selected != null) { List<Item> refreshedList = new ArrayList<>(items); selected.setValue(t1.doubleValue()); // Some table columns aren't observable and sorting may have changed // (not shown here)... Whatever, refresh the table items.setAll(refreshedList); } } }); BorderPane root = new BorderPane(); root.setTop(new Label("Pick a row and adjust the slider")); root.setCenter(table); root.setBottom(valueSlider); Scene scene = new Scene(root, 300, 250); primaryStage.setTitle("Table Flicker"); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { launch(args); } }
03-04-2013

The flicker happens when setAll is called on the item list. Emailing test case.
03-04-2013

Do you have a small test application that demonstrates this?
01-04-2013

Note that the display always settles on the correct row background colors. There is just always a refresh of the display where it is wrong as well.
29-03-2013