Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use </p> <pre><code>.table-row-cell { -fx-cell-size: 50px; } </code></pre> <p>The <code>.table-row-cell</code> is the class assigned to the table rows, as stated in <code>capian.css</code>, available at jfxrt.jar (com/sun/javafx/scene/control/skin/caspian/caspian.css): </p> <blockquote> <p>Each row in the table is a table-row-cell. Inside a table-row-cell is any number of table-cell. </p> </blockquote> <p>And <code>-fx-cell-size</code>, in this case, is the row height (actually, each cell height), as confirmed at <a href="http://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html#cell" rel="noreferrer">Oracle's JavaFX CSS Reference Guide</a></p> <blockquote> <p><strong>-fx-cell-size</strong>: The cell size. For vertical ListView or a TreeView or TableView this is the height, for a horizontal ListView this is the width.</p> </blockquote> <p>I tried the solution above on the following example:</p> <p><strong>PetsTable:</strong> (Note the use of <code>scene.getStylesheets().add("styles/styles.css");</code>, defining the css file to be employed)</p> <pre><code>import javafx.application.Application; import javafx.beans.property.SimpleStringProperty; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.stage.Stage; public class PetsTable extends Application { @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Pets"); stage.setWidth(200); stage.setHeight(200); ObservableList&lt;Pet&gt; data = FXCollections.observableArrayList(new Pet("Kitty", "Susan"), new Pet("Ploft", "Jackob")); TableView&lt;Pet&gt; table = new TableView&lt;Pet&gt;(); TableColumn name = new TableColumn("Name"); name.setMinWidth(100); name.setCellValueFactory(new PropertyValueFactory&lt;Pet, String&gt;("name")); TableColumn owner = new TableColumn("Owner"); owner.setMinWidth(100); owner.setCellValueFactory(new PropertyValueFactory&lt;Pet, String&gt;("owner")); table.setItems(data); table.getColumns().addAll(name, owner); ((Group) scene.getRoot()).getChildren().addAll(table); /**********************************************/ /********* Setting the css style file *******/ /**********************************************/ scene.getStylesheets().add("styles/styles.css"); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } public static class Pet { private final SimpleStringProperty name; private final SimpleStringProperty owner; private Pet(String name, String owner) { this.name = new SimpleStringProperty(name); this.owner = new SimpleStringProperty(owner); } public String getName() { return name.get(); } public String getOwner() { return owner.get(); } } } </code></pre> <p><strong>styles.css:</strong></p> <pre><code>.table-row-cell { -fx-cell-size: 50px; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload