- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有以下 FXML:
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane id="AnchorPane" prefHeight="600.0" prefWidth="1000.0" stylesheets="@../css/fxmlDemo.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="fxmldemo.controller.MainController">
<children>
<TreeTableView fx:id="treeTableView" prefHeight="600.0" prefWidth="1000.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" xmlns:fx="http://javafx.com/fxml">
<columns>
<TreeTableColumn fx:id="nameColumn" prefWidth="600.0" text="Name" />
<TreeTableColumn fx:id="sizeColumn" prefWidth="100.0" text="Size" />
<TreeTableColumn fx:id="lastModifiedColumn" prefWidth="300.0" text="Modified" />
</columns>
</TreeTableView>
</children>
</AnchorPane>
在我的 fxmlDemo.css 文件中,我尝试了如下操作:
* {
-fx-border-style: solid;
}
和
tree-table-view {
-fx-border-style: solid;
}
和
tree-item {
-fx-border-style: solid;
}
第一个在 FXML 中的所有内容周围放置一个边框,其他两个什么都不做。
我想要的是像 Excel 电子表格一样显示网格线。我使用的代码与 this 中看到的非常相似例如,但我的已经修改为实际工作:)
Here是指向 Java FX CSS 引用指南的链接,但它不包含有关 TreeTableView 或其子组件的信息。
最佳答案
使用以下 CSS,我能够将 TreeTableView 配置为看起来与 TableView 非常相似。
.tree-table-row-cell {
-fx-background-color: -fx-table-cell-border-color, -fx-control-inner-background;
-fx-background-insets: 0, 0 0 1 0;
-fx-padding: 0.0em;
-fx-text-fill: -fx-text-inner-color;
}
.tree-table-row-cell:selected {
-fx-background-color: -fx-focus-color, -fx-cell-focus-inner-border, -fx-focus-color;
-fx-background-insets: 0, 1, 2;
}
.tree-table-row-cell:odd {
-fx-background-color: -fx-table-cell-border-color, derive(-fx-control-inner-background,-5%);
-fx-background-insets: 0, 0 0 1 0;
}
.tree-table-row-cell:selected:odd {
-fx-background-color: -fx-focus-color, -fx-cell-focus-inner-border, -fx-focus-color;
-fx-background-insets: 0, 1, 2;
}
请记住,您可以在场景中删除和添加样式表,这将加快您的开发时间。
关于fxml - 如何在 TreeTableView 中显示行的网格线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21704598/
我有一个TreeTableView,其中每个节点都有一个图标。当我伸展树(Splay Tree)时,一切正常,但是当我折叠树时,不再可见的项目的图标会被留下。 行和文本被删除,但图标仍然“自由 flo
我正在使用 TreeTableView 来显示树的内容。树中的排序顺序是手动的,我希望能够拖放项目。 如何在 TreeTableView 中拖放项目? 最佳答案 一种方法是使用“treeTableVi
我需要将树 TableView 的列中显示的值居中,如何将位置从左侧更改为中心? final TreeTableColumn dataColumn = new TreeTableColumn<>("D
我的问题是如何使用我自己的Comparator创建一个treetableview(JavaFX8)。 我找到了一些例子,例如 JavaFX TableView Sort Policy但它们都是Tabl
我想将图像添加到 TreeTableView 中的每个节点。为了做到这一点,我编写了以下内容(根据 Google 找到的一些页面): 调用更新 View Controller 中的 View publ
如何获取对 TreeTableView 中展开/折叠“箭头”的引用? 我无法提供任何代码,因为我真的不知道要寻找什么。 这是一张显示我需要的图片。突出显示的箭头是我需要的。 我想删除它,同时保留折叠/
我有以下 FXML:
我们努力实现以下目标: 当在 JavaFX TreeTableView 中选择一个节点时,还应该选择“根路径”,即父节点、祖父节点等。在这种情况下选择意味着用不同的背景颜色突出显示,请参见图像(在示例
我现在正在学习 JavaFX,但我似乎无法做对一件事。基本上我想做的是一个具有多重选择的 TreeTableView,在我尝试对列表进行排序之前它工作得很好。 代码如下(示例 15-1 来自 http
我想要实现的目标是或多或少拥有 Sale 对象,当它扩展为在该 Sale 对象下显示 SaleTransaction 对象时。类似于 Code Project 的图像中显示了想要的内容 除了读取之外,
thisColumn.setCellFactory(new Callback, TreeTableCell>() { @Override public TreeTableCell ca
我正在使用 JavaFX 中的 TreeTableView 类来实现分组股票行情观察列表。排序时,我只想对股票进行排序(而不是组)。目前,当我单击“符号”列(例如)时,它会对每个组中的股票进行排序(正
我注意到 TreeTableView 中有一个奇怪的 NPE 如果您在没有行的表格中双击,就会发生这种情况。我将附上屏幕截图以准确说明我的意思。 我纯粹来自 JavaFx 它与我的代码无关。我也做了一
我正在使用 TreeTableView ,我想根据所选行中的数据更改与上下文菜单关联的菜单项。 假设我有一个结构如下的表: 访客 访客1 访客2 访客 3 喋喋不休 喋喋不休1 喋喋不休2 在此表中,
我有一个 JFXTreeTableView,我想将每一列的数据文本居中。 有一个我创建列的代码: JFXTreeTableColumn DrinkColumn = new JFXTreeTableCo
我正在尝试设置 TreeTableView 的背景。 使用的 CSS 样式: .tree-table-cell, cell{ -fx-background-color: rgba(0, 0, 0
我一直在试验 JDK 8 中的 TreeTableView。在我的程序启动并运行后,我注意到一个问题,即当我滚动时,行会被清空。我已经尝试了一切,从重置单元格的可见性,更新时希望它在更新时重绘,甚至重
我想修改 TreeTableView 的点击行为,但老实说,我不确定这样做的预期方式应该是什么样子,或者是否需要更改它以任何方式。 大多数用户提示当前的行为不一致。有时单击一个单元格已经折叠/伸展树(
与 TreeTableView 一起工作时我意识到当您向下滚动表格并双击最后一个展开/折叠箭头时,所有项目都会消失。但是,当您再次滚动时,所有项目都会重新出现。当然,当你有足够的元素时会发生这种情况,
我在 FX、CSS 和 TreeTableView 方面遇到了一些问题。我有包含蓝色超链接的单元格。现在,如果选择该单元格,背景就会变成蓝色,因此该链接实际上是不可见的。我现在想使用样式表更改所选单元
我是一名优秀的程序员,十分优秀!