JAVAFX的table样式修改

这篇博客详细介绍了如何使用CSS来定制JavaFX中的表格视图(TableView)的样式,包括字体大小、表头背景色、边框、单元格高度等,以实现更美观的界面展示。

在这里插入图片描述
直接上代码吧,

.table-view{
  -fx-font-size: 16;    修改表格字体的大小
}
表头的背景设置
.table-view  .column-header-background {
    -fx-background-color: #DBDBDB; 
}
表头设置
.table-view .column-header{
   -fx-border-color:#ffffff;    
   -fx-border-width:0 1 0 0;     这个是为了解决默认的边框
   
   -fx-alignment: center;
   -fx-pref-height: 46;    高度设置
}
/*表格内容区域*/
.table-view .placeholder {
   -fx-background-color: transparent;  
}

/*表格列*/
.table-column {
   -fx-pref-height: 60;
   -fx-background-color: transparent;
   -fx-alignment: center;
   
}

/*表格内容区域每行的样式*/
.table-row-cell {
   -fx-background-color: #ffffff;
}

.table-row-cell:odd {
   -fx-background-color: #E9F3FF;
}

.table-row-cell .table-cell {  
   -fx-border-width: 1px;  
}  

.table-row-cell:selected{
   -fx-text-fill: black;
   -fx-background-color: #007FE1;
}
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值