B4J Question [SOLVED] Change textcolor of tableview...

Magma

Expert
Licensed User
Longtime User
Upvote 0

inakigarm

Well-Known Member
Licensed User
Longtime User
Try loading the Tableview css as external file with MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "tbl.css"))

where tbl.css is a text file comprising this:
// formato para las celdas del tableview
.table-cell {
-fx-padding: 0.5em 0.5em 0.1em 0.3em;
-fx-border-color: -fx-box-border -fx-box-border transparent transparent;
-fx-font: 13px "Segoe UI";
-fx-border-insets: 0;
-fx-text-fill: red;
}

// color de fondo para cuando el raton este sobre la celda
.table-cell:hover {
-fx-background-color: #9900ff;
}

// color para filas vacias,
// aplicar el mismo color cuando el raton este sobre una celda de una fila vacia
.table-row-cell:empty, .table-cell:empty:hover {
-fx-background-color: whitesmoke;
}

// eliminar borde de celdas en las filas vacias
.table-row-cell:empty .table-cell {
-fx-border-width: 0px;
}

// color de una fila cuando en raton se encuentra sobre la misma
.table-view:row-selection .table-row-cell:filled:hover {
-fx-background-color: rgba(28, 183, 236, 0.25);
}

// color de una fila cuando en raton se encuentra sobre una fila que esta seleccionada
.table-view:row-selection .table-row-cell:filled:selected:hover {
-fx-background-color: rgba(228, 183, 236, 0.90);
}

// color de una fila seleccionada por el usuario
.table-view:row-selection .table-row-cell:filled:selected {
-fx-background-color: rgba(28, 183, 236, 0.65);
}

// eliminar border del table que aparece cuando el mismo tiene el foco
.table-view, .table-view:focused {
-fx-background-color: transparent,-fx-box-border,-fx-control-inner-background;
-fx-background-insets: -1.4, 0, 1;
-fx-background-radius: 1.4, 0, 0;
}

// centrar y cambiar color de los titulos de columnas
.table-view .column-header .label{
-fx-text-fill: #52677A;
-fx-alignment: CENTER;
}

// color de fondo del titulo de columna cuando en roton esta sobre ella
.table-view .column-header:hover {
-fx-background-color: whitesmoke;
}

// tamaño, bordes y color de fondo de los titulos
.table-view .column-header, .table-view .filler {
-fx-background-color: white;
-fx-size: 45;
-fx-border-color: -fx-box-border;
-fx-border-width: 0 1 3 0;
-fx-border-insets: 0;
}

// hacer transparente el fondo de los titulos
.table-view .column-header-background {
-fx-background-color: transparent;
}

// estylo para el boton que permite ocultar o mostrar las columnas
.table-view .show-hide-columns-button {
-fx-background-color: white;
-fx-border-color: -fx-box-border;
-fx-border-insets: 0;
}
Play with values to find the ones you want; another option is fill the tableview's cells with labels and set the text color of the label.
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
B4X:
.table-cell {
-fx-text-fill:black;
}

.table-view .column-header .label{
-fx-text-fill: black;
-fx-alignment: CENTER;
}

Try loading the Tableview css as external file with MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "tbl.css"))

where tbl.css is a text file comprising this:
// formato para las celdas del tableview
.table-cell {
-fx-padding: 0.5em 0.5em 0.1em 0.3em;
-fx-border-color: -fx-box-border -fx-box-border transparent transparent;
-fx-font: 13px "Segoe UI";
-fx-border-insets: 0;
-fx-text-fill: red;
}

// color de fondo para cuando el raton este sobre la celda
.table-cell:hover {
-fx-background-color: #9900ff;
}

// color para filas vacias,
// aplicar el mismo color cuando el raton este sobre una celda de una fila vacia
.table-row-cell:empty, .table-cell:empty:hover {
-fx-background-color: whitesmoke;
}

// eliminar borde de celdas en las filas vacias
.table-row-cell:empty .table-cell {
-fx-border-width: 0px;
}

// color de una fila cuando en raton se encuentra sobre la misma
.table-view:row-selection .table-row-cell:filled:hover {
-fx-background-color: rgba(28, 183, 236, 0.25);
}

// color de una fila cuando en raton se encuentra sobre una fila que esta seleccionada
.table-view:row-selection .table-row-cell:filled:selected:hover {
-fx-background-color: rgba(228, 183, 236, 0.90);
}

// color de una fila seleccionada por el usuario
.table-view:row-selection .table-row-cell:filled:selected {
-fx-background-color: rgba(28, 183, 236, 0.65);
}

// eliminar border del table que aparece cuando el mismo tiene el foco
.table-view, .table-view:focused {
-fx-background-color: transparent,-fx-box-border,-fx-control-inner-background;
-fx-background-insets: -1.4, 0, 1;
-fx-background-radius: 1.4, 0, 0;
}

// centrar y cambiar color de los titulos de columnas
.table-view .column-header .label{
-fx-text-fill: #52677A;
-fx-alignment: CENTER;
}

// color de fondo del titulo de columna cuando en roton esta sobre ella
.table-view .column-header:hover {
-fx-background-color: whitesmoke;
}

// tamaño, bordes y color de fondo de los titulos
.table-view .column-header, .table-view .filler {
-fx-background-color: white;
-fx-size: 45;
-fx-border-color: -fx-box-border;
-fx-border-width: 0 1 3 0;
-fx-border-insets: 0;
}

// hacer transparente el fondo de los titulos
.table-view .column-header-background {
-fx-background-color: transparent;
}

// estylo para el boton que permite ocultar o mostrar las columnas
.table-view .show-hide-columns-button {
-fx-background-color: white;
-fx-border-color: -fx-box-border;
-fx-border-insets: 0;
}
Play with values to find the ones you want; another option is fill the tableview's cells with labels and set the text color of the label.


Thank you all - @inakigarm was very helpful!
 
Upvote 0
Top