Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8909257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:23:05+00:00 2026-06-15T03:23:05+00:00

JavaFX documentation seems to imply that if a property is defined in the CSS

  • 0

JavaFX documentation seems to imply that if a property is defined in the CSS root class it can be referred to by any object in the scene:

The .root style class includes properties that can be used by other styles to provide consistency in a UI. For example, the property -fx-focused-base is defined in the .root style. This property is used by styles for other UI controls as the color for the control when it has focus.

For example, in the following simple application:

public class Main extends Application {

@Override
public void start(Stage stage) throws Exception {
    AnchorPane pane = new AnchorPane();
    Scene s = new Scene(pane, 800, 600);

    pane.getStylesheets().add("test.css");
    pane.getStyleClass().add("test");

    System.out.println("Root pane style classes:");
    for (String clazz : pane.getStyleClass())
        System.out.println(clazz);

    stage.setScene(s);
    stage.show();
}

public static void main(String[] args) {
    Application.launch();
}
}

With the following stylesheet test.css:

.test {
-fx-background-color: -fx-base;
}

Results in the following output:

Root pane style classes:
root
test
WARNING: com.sun.javafx.css.StyleHelper calculateValue Could not resolve '-fx-base' while resolving lookups for '-fx-background-color' from rule '*.test' in stylesheet test.css

(I removed the file path from the warning)

Why isnt it able to resolve -fx-base? It is clearly included in caspian.css…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:23:07+00:00Added an answer on June 15, 2026 at 3:23 am

    It appears the issue here is that the stylesheet (caspian.css) is lazily loaded. Therefore, unless a component is constructed (not even necessarily added) the stylesheet is not resolved. Layout containers (like AnchorPane) do not trigger loading of the stylesheet. On the other hand, Controls (like Button/CheckBox/Label etc.) will trigger the stylesheet to be loaded.

    Here is an updated version of the test case above to illustrate this behavior:

    public class Main extends Application {
    
    @Override
    public void start(Stage stage) throws Exception {
        AnchorPane pane = new AnchorPane();
    
        new Button(); // Trigger loading of default stylesheet
    
        Scene s = new Scene(pane, 800, 600);
        pane.getStylesheets().add("test.css");
        pane.getStyleClass().add("test");
    
        System.out.println("Root pane style classes:");
        for (String clazz : pane.getStyleClass())
            System.out.println(clazz);
    
        stage.setScene(s);
        stage.show();
    }
    
    public static void main(String[] args) {
        Application.launch();
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently started learning JavaFX. At the moment I can't build any JavaFX project
Reading blogs and articles on using css in javafx, I see class selectors such
Using JavaFX within Swing, I create a JFXPAnel and a ScatterChart to the Scene.
In JavaFx i can easy create animations, moving pieces etc., but as far as
I'm using JavaFX integrated HTMLEditor. All the functions that it has are fine but
I've written a JavaFX application that uses Java Web Start. For some reason, the
The Eclipselink documentation says that I need the following entries in my pom.xml to
How can I get the actual position of a node in the scene .
In Documentation for Android SDK, API 8, the javadoc for class android.test.InstrumentationTestRunner mentions command-line
Thare is a tutorial at javaFX documentation page. This example describes how to make

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.