Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JavaFX 2.2: How to read the TableView font after setting it from an external CSS?

c54cddc6-aab0-4d5f-a560-0dce725928e9Jul 31 2015 — edited Jul 31 2015

Hi everyone!

My JavaFX 2.2 application allows to set an external CSS to a TableView.

    table.getStylesheets().add(path);

This works and the style is set. However, I want to get the cell font size.

    .table-row-cell{

  -fx-font: 20px arial;

    }

When I write

    System.out.println(table.getStyle());

an empty string is returned.

If I use the inline style setting, for example

    table.setStyle("-fx-font: 20px arial");

then getStyle works. It prints "-fx-font: 20px arial".

So what's the issue here? How can I read the table cells font after setting it with getStylesheets.add(css file)?

Obviously, I don't want to parse the whole CSS file if possible! Java CSS parsers are very lacking and they don't work properly for JavaFX CSS.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 28 2015
Added on Jul 31 2015
0 comments
728 views