【问题标题】:Styling a TableView in CSS (JavaFX)在 CSS (JavaFX) 中为 TableView 设置样式
【发布时间】:2016-02-29 13:25:44
【问题描述】:

如何在 TableView 中设置“THIS”点的样式?

我的 CSS 代码如下所示:

   */*
 * Empty Stylesheet file.
 */

.root{
    -fx-background-color: #262626;
}

.table-view{
   -fx-background-color: transparent;
}

.table-view:focused{
    -fx-background-color: transparent;
}

/* Spaltenköpfe
    Struktur column-header-background -> column-header */

.table-view .column-header-background{
    -fx-background-color: linear-gradient(#131313 0%, #424141 100%);
}

.table-view .column-header-background .label{
    -fx-background-color: transparent;
    -fx-text-fill: white;
}

.table-view .column-header {
    -fx-background-color: transparent;
}

.table-view .table-cell{
    -fx-text-fill: white;
}

.table-row-cell{
    -fx-background-color: -fx-table-cell-border-color, #616161;
    -fx-background-insets: 0, 0 0 1 0;
    -fx-padding: 0.0em; /* 0 */
}

.table-row-cell:odd{
    -fx-background-color: -fx-table-cell-border-color, #424242;
    -fx-background-insets: 0, 0 0 1 0;
    -fx-padding: 0.0em; /* 0 */  
}

.table-row-cell:selected {
    -fx-background-color: #005797;
    -fx-background-insets: 0;
    -fx-background-radius: 1;
}

.table-view > .virtual-flow > .scroll-bar:vertical,
.table-view > .virtual-flow > .scroll-bar:vertical > .track,
.table-view > .virtual-flow > .scroll-bar:vertical > .track-background, 
.table-view > .virtual-flow > .scroll-bar:horizontal,
.table-view > .virtual-flow > .scroll-bar:horizontal > .track,
.table-view > .virtual-flow > .scroll-bar:horizontal > .track-background {
    -fx-background-color: transparent;
}



.table-view > .virtual-flow > .scroll-bar > .increment-button, 
.table-view > .virtual-flow > .scroll-bar > .decrement-button {
    -fx-opacity: 0;
}*

如您所见,我已经更改了colum-header-background 和类似的所有内容。我还改变了 TableView 的背景。所以我真的不知道我应该在我的 CSS 中改变什么。 感谢您的每一个帮助! :)

-GhostfaceChilla-

【问题讨论】:

    标签: java css javafx tableview styling


    【解决方案1】:

    .table-view .filler 是您正在寻找的选择器。 scenic view tool 非常适合分析组件。

    【讨论】:

      【解决方案2】:
      .table-view{
         -fx-background-color: transparent;
      }
      

      如果 TableView 中没有记录,背景颜色可以是白色。为占位符设置样式也许很好

      【讨论】:

        【解决方案3】:

        如果有人来这里搜索 column-show-hide 按钮的 CSS,这里是 CSS。

        .table-view .show-hide-columns-button {
            -fx-background-color: red;
            -fx-border-color: -fx-box-border;
            -fx-border-insets: -1 -1 0 0;
        }
        

        【讨论】:

          【解决方案4】:

          我设法用这个 CSS 代码解决了这个问题:

          .table-view .filler {
              -fx-border-insets: 10 //Enter value depending on thickness;
          }
          

          【讨论】:

            【解决方案5】:

            试试这个

            .table-view .filler{
                -fx-background-color: transparent;
            }
            

            【讨论】:

              【解决方案6】:

              试试这个。

              .table-view .column-header-background
              {
                  -fx-background-color: transparent;
              }
              

              【讨论】:

                猜你喜欢
                • 2016-04-18
                • 1970-01-01
                • 1970-01-01
                • 2015-08-07
                • 2020-09-10
                • 1970-01-01
                • 1970-01-01
                • 2020-05-22
                • 1970-01-01
                相关资源
                最近更新 更多