【问题标题】:Table design in JavaFxJavaFx 中的表格设计
【发布时间】:2018-02-06 14:27:47
【问题描述】:

如何在 javafx 中设计一个类似上面的表格。我正在使用 tableview 并做了一些 css,但设计并没有我想要的那么好。

谁能告诉我如何实现上述设计

这是我试过的css

.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 */
}

当前设计表

【问题讨论】:

  • 能否请您附上当前视图的图像,以及您在复制时遇到问题的具体点?
  • @sillyfly 我已经添加了当前的表格设计

标签: java javafx java-8 javafx-2 javafx-8


【解决方案1】:

这个图的css:

.table-view .column-header,
.table-view .column-header .filler,
.table-view .column-header-background .filler {   
    -fx-background-color: derive;
    -fx-stroke: transparent;
    -fx-size:50;
    -fx-alignment: CENTER ;    
    -fx-text-alignment: center;

}
.table-row-cell:filled:hover {

    -fx-size:50;
    -fx-alignment: CENTER;
    -fx-text-alignment: center;


}
.table-view:row-selection {
    -fx-background-color: transparent;
    -fx-text-fill: white;
    -fx-fixed-cell-size: 50;
    -fx-alignment: CENTER;
    -fx-text-alignment: center;

}

.table-view .table-column{
    -fx-text-alignment: center;
    -fx-alignment: CENTER 

}
猜你喜欢
  • 2018-07-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-07-28
  • 1970-01-01
  • 2015-04-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多