treecell

JavaFX-CSS: How to “move” style of parent to a child?

假如想象 提交于 2020-01-01 16:46:26
问题 The trigger for this was a quick experiment to solve TreeItem selection width: the requirement is to highlight only the text, not the whole tree cell. Nothing easier than that (said Frederik :) implement a custom TreeCell with a Label as graphic (and configure the label with the item as needed) remove the selection style (mostly the highlight background from the cell add the highlight style to the label Something like (a runnable example using this is at the end): public static class

JavaFX-CSS: How to “move” style of parent to a child?

扶醉桌前 提交于 2020-01-01 16:46:22
问题 The trigger for this was a quick experiment to solve TreeItem selection width: the requirement is to highlight only the text, not the whole tree cell. Nothing easier than that (said Frederik :) implement a custom TreeCell with a Label as graphic (and configure the label with the item as needed) remove the selection style (mostly the highlight background from the cell add the highlight style to the label Something like (a runnable example using this is at the end): public static class

Get a list of all TreeCell objects that currently exist in a TreeView

我的未来我决定 提交于 2019-12-24 14:46:42
问题 I know that TreeCell objects are generated dynamically by the TreeView using a cell factory. Is there a way to get a list of all TreeCell objects that currently exist? I suppose I could keep track of them by modifying the cell factory. As in, whenever I create a new cell add it to some list. But then I'm not sure how to remove cells from my list once the TreeView disposes them (because they went out of view). 回答1: My solution to this is to use weak references: [A] weak reference is a

JavaFX-CSS: How to “move” style of parent to a child?

妖精的绣舞 提交于 2019-12-04 13:16:30
The trigger for this was a quick experiment to solve TreeItem selection width : the requirement is to highlight only the text, not the whole tree cell. Nothing easier than that (said Frederik :) implement a custom TreeCell with a Label as graphic (and configure the label with the item as needed) remove the selection style (mostly the highlight background from the cell add the highlight style to the label Something like (a runnable example using this is at the end): public static class MyTreeCell extends TreeCell<String> { private Label label; public MyTreeCell() { getStyleClass().add("tree