本文整理汇总了Java中javafx.scene.control.TreeItem.setGraphic方法的典型用法代码示例。如果您正苦于以下问题:Java TreeItem.setGraphic方法的具体用法?Java TreeItem.setGraphic怎么用?Java TreeItem.setGraphic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.TreeItem
的用法示例。
在下文中一共展示了TreeItem.setGraphic方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createObject
import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
void createObject(Path path, boolean isRoot) {
if (isRoot) {
TreeItem<Path> rootNode = setRootItem(path);
treeView.setRoot(rootNode);
} else {
TreeItem<Path> parent = getItem(treeView.getRoot(), path.getParent());
WatcherStructure watcherStructure = null;
if (Files.isDirectory(path)) {
watcherStructure = new WatcherStructure(path, project, tabUpdater, this);
}
TreeItem<Path> newItem = new CustomTreeItem(path, watcherStructure, project, tabUpdater, this);
CustomIcons customIcons = new CustomIcons();
if (Files.isDirectory(path)) {
newItem.setGraphic(new ImageView(customIcons.getFolderCollapseImage()));
newItem.expandedProperty().addListener(expanderListener());
} else {
newItem.setGraphic(new ImageView(customIcons.getFileImage()));
}
parent.getChildren().add(newItem);
sortItemsInTree(parent);
}
}
示例2: expanderListener
import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
public ChangeListener<Boolean> expanderListener() {
return (observable, oldValue, newValue) -> {
BooleanProperty bb = (BooleanProperty) observable;
TreeItem t = (TreeItem) bb.getBean();
CustomIcons customIcons = new CustomIcons();
t.setGraphic(new ImageView(newValue ? customIcons.getFolderExpandImage() : customIcons.getFolderCollapseImage()));
if (newValue) {
scheduleHighlight();
}
};
}
示例3: loadTVDataBase
import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
/**
* 加载数据库到树集
*
* @throws Exception
*/
public void loadTVDataBase() throws Exception {
TreeItem<String> rootTreeItem = tvDataBase.getRoot();
rootTreeItem.getChildren().clear();
List<DatabaseConfig> item = null;
item = ConfigUtil.getDatabaseConfig();
for (DatabaseConfig dbConfig : item) {
TreeItem<String> treeItem = new TreeItem<String>();
treeItem.setValue(dbConfig.getConnName());
ImageView dbImage = new ImageView("image/database.png");
dbImage.setFitHeight(20);
dbImage.setFitWidth(20);
dbImage.setUserData(dbConfig);
treeItem.setGraphic(dbImage);
rootTreeItem.getChildren().add(treeItem);
}
}
示例4: setRootItem
import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
private TreeItem<Path> setRootItem(Path path) {
WatcherStructure rootInWatcher = new WatcherStructure(path, project, tabUpdater, this);
TreeItem<Path> rootNode = new CustomTreeItem(path, rootInWatcher, project, tabUpdater, this);
rootNode.setExpanded(true);
CustomIcons customIcons = new CustomIcons();
rootNode.setGraphic(new ImageView(customIcons.getFolderExpandImage()));
rootNode.expandedProperty().addListener(expanderListener());
return rootNode;
}
示例5: createItem
import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
public TreeItem<String> createItem(Collection collection) {
TreeItem<String> item = new TreeItem<>(collection.getName());
item.setGraphic(new TangoIconWrapper("places:folder"));
return item;
}
示例6: addNode
import javafx.scene.control.TreeItem; //导入方法依赖的package包/类
public static TreeItem<Object> addNode(final TreeItem<Object> item, final TreeItem<Object> parent, final boolean expanded, final GlyphIcons icon)
{
// TreeItem<String> item = new TreeItem<String>(title);
item.setExpanded(expanded);
if (icon != null)
item.setGraphic(GlyphsDude.createIcon(icon, TREE_ICON_SIZE));
parent.getChildren().add(item);
return item;
}