Description
Editing a TableCell using a ComboBox cell editor generates CSS warning messages.
Reproduction steps:
1. Run the sample code.
2. Click on a cell in the table to start editing it.
3. Select a new value for the cell from the drop down combo.
4. Warning messages will be printed to system.err.
Warning message sample:
May 05, 2014 11:25:57 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-fx-text-background-color' while resolving lookups for '-fx-text-fill' from rule '*.list-cell' in stylesheet jar:file:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
May 05, 2014 11:25:57 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-fx-selection-bar' while resolving lookups for '-fx-background-color' from rule '*.combo-box-popup>*.list-view>*.virtual-flow>*.clipped-container>*.sheet>*.list-cell:hover:filled:selected' in stylesheet jar:file:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Sample code:
import javafx.application.Application;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.*;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.cell.*;
import javafx.stage.Stage;
public class ComboTableStyleWarning extends Application {
public enum Day { mon, tue, wed, thu, fri }
private final ObservableList<WorkDay> data = FXCollections.observableArrayList(
new WorkDay(Day.mon),
new WorkDay(Day.fri),
new WorkDay(Day.thu)
);
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) {
TableColumn<WorkDay, Day> dayCol = new TableColumn<>("Work Day");
dayCol.setMinWidth(100);
dayCol.setCellValueFactory(new PropertyValueFactory<>("day"));
dayCol.setCellFactory(ComboBoxTableCell.<WorkDay, Day>forTableColumn(Day.values()));
dayCol.setEditable(true);
TableView<WorkDay> table = new TableView<>();
table.setEditable(true);
table.setItems(data);
table.getColumns().addAll(dayCol);
stage.setTitle("**Double-click a day to edit it**");
stage.setScene(new Scene(table));
stage.show();
}
public static class WorkDay {
private final SimpleObjectProperty<Day> day;
private WorkDay(Day day) {
this.day = new SimpleObjectProperty<>(day);
}
public Day getDay() {
return day.get();
}
public void setDay(Day day) {
this.day.set(day);
}
}
}
Editing a TableCell using a ComboBox cell editor generates CSS warning messages.
Reproduction steps:
1. Run the sample code.
2. Click on a cell in the table to start editing it.
3. Select a new value for the cell from the drop down combo.
4. Warning messages will be printed to system.err.
Warning message sample:
May 05, 2014 11:25:57 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-fx-text-background-color' while resolving lookups for '-fx-text-fill' from rule '*.list-cell' in stylesheet jar:file:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
May 05, 2014 11:25:57 PM javafx.scene.CssStyleHelper calculateValue
WARNING: Could not resolve '-fx-selection-bar' while resolving lookups for '-fx-background-color' from rule '*.combo-box-popup>*.list-view>*.virtual-flow>*.clipped-container>*.sheet>*.list-cell:hover:filled:selected' in stylesheet jar:file:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/jre/lib/ext/jfxrt.jar!/com/sun/javafx/scene/control/skin/modena/modena.bss
Sample code:
import javafx.application.Application;
import javafx.beans.property.SimpleObjectProperty;
import javafx.collections.*;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.cell.*;
import javafx.stage.Stage;
public class ComboTableStyleWarning extends Application {
public enum Day { mon, tue, wed, thu, fri }
private final ObservableList<WorkDay> data = FXCollections.observableArrayList(
new WorkDay(Day.mon),
new WorkDay(Day.fri),
new WorkDay(Day.thu)
);
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) {
TableColumn<WorkDay, Day> dayCol = new TableColumn<>("Work Day");
dayCol.setMinWidth(100);
dayCol.setCellValueFactory(new PropertyValueFactory<>("day"));
dayCol.setCellFactory(ComboBoxTableCell.<WorkDay, Day>forTableColumn(Day.values()));
dayCol.setEditable(true);
TableView<WorkDay> table = new TableView<>();
table.setEditable(true);
table.setItems(data);
table.getColumns().addAll(dayCol);
stage.setTitle("**Double-click a day to edit it**");
stage.setScene(new Scene(table));
stage.show();
}
public static class WorkDay {
private final SimpleObjectProperty<Day> day;
private WorkDay(Day day) {
this.day = new SimpleObjectProperty<>(day);
}
public Day getDay() {
return day.get();
}
public void setDay(Day day) {
this.day.set(day);
}
}
}
- relates to
-
JDK-8197846 ComboBox: becomes unclickable after removal and re-adding
- Resolved