Results 1 to 2 of 2
  1. #1
    SystemL is offline Member
    Join Date
    Apr 2015
    Posts
    4
    Rep Power
    0

    Default javafx Could not load stylesheet: rsrc:main.css ?? My use eclipse and openjdk

    Hi my name luigi from italy .. my problem export jar file runnable ..
    Java Code:
     java --module-path="/java/lib/javafx-sdk-11.0.2/lib/" --add-modules=ALL-MODULE-PATH -jar calculator.jar
    output:
    Java Code:
    feb 18, 2020 2:11:00 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
    INFO: Could not load stylesheet: rsrc:main.css
    MY CODE START OVVERIDE:
    Java Code:
     AnchorPane root = (AnchorPane)FXMLLoader.load(getClass().getResource("main.fxml"));
            Scene scene = new Scene(root);
            scene.getStylesheets().add(getClass().getResource("main.css").toExternalForm());
            stage.setTitle("Calculator");
            stage.setOnCloseRequest(x -> {
                Platform.exit();
            });
     
            stage.setScene(scene);
            stage.show();
    MY FXML:

    Java Code:
    <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="249.0" prefWidth="493.0" styleClass="background" stylesheets="@main.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="net.argius.calculator.App">
    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <?import javafx.scene.control.Button?>
    <?import javafx.scene.control.TextField?>
    <?import javafx.scene.layout.AnchorPane?>
    <?import javafx.scene.text.Font?>
    
    <AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="249.0" prefWidth="493.0" styleClass="background" stylesheets="@main.css" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="net.argius.calculator.App">
       <children>
          <Button layoutX="71.0" layoutY="171.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" text="1" />
          <Button layoutX="106.0" layoutY="171.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" text="2" />
          <Button layoutX="140.0" layoutY="171.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" text="3" />
          <Button layoutX="71.0" layoutY="134.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" text="4" />
          <Button layoutX="106.0" layoutY="134.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" text="5" />
          <Button layoutX="140.0" layoutY="134.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" text="6" />
          <Button layoutX="71.0" layoutY="97.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" text="7" />
          <Button layoutX="106.0" layoutY="97.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" text="8" />
          <Button layoutX="140.0" layoutY="97.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" text="9" />
          <TextField fx:id="display" alignment="BOTTOM_RIGHT" editable="false" layoutX="31.0" layoutY="14.0" prefHeight="35.0" prefWidth="178.0" styleClass="display" text="0">
             <font>
                <Font name="Lucida Console" size="20.0" />
             </font>
          </TextField>
          <Button layoutX="27.0" layoutY="97.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" text="C" />
          <Button layoutX="167.0" layoutY="208.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" prefHeight="23.0" prefWidth="47.0" text="=" />
          <Button layoutX="187.0" layoutY="171.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" text="+" />
          <Button layoutX="71.0" layoutY="208.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" text="0" />
          <Button layoutX="187.0" layoutY="134.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" text="-" />
          <Button layoutX="188.0" layoutY="97.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" prefHeight="23.0" prefWidth="25.0" styleClass="background" text="" />
          <Button layoutX="188.0" layoutY="61.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" styleClass="background" text="" />
          <Button layoutX="25.0" layoutY="61.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" text="AC" />
          <Button layoutX="142.0" layoutY="208.0" mnemonicParsing="false" onAction="#handleOnAnyButtonClicked" text="." />
       </children>
    </AnchorPane>
    My 2 hours problem launch normal jar file ..

    how to problem solved?

    My elementary english

    Thanks.
    Last edited by SystemL; 02-18-2020 at 03:15 PM.

  2. #2
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    399
    Rep Power
    7

    Default Re: javafx Could not load stylesheet: rsrc:main.css ?? My use eclipse and openjdk

    I am sure this has been solved somewhere else by now, just for completeness:
    check this.

Similar Threads

  1. Can't load an image to he background with Javafx
    By Deathslice in forum JavaFX
    Replies: 9
    Last Post: 04-04-2015, 06:43 PM
  2. OpenJDK vs OracleJDK Performance
    By spadez in forum New To Java
    Replies: 1
    Last Post: 05-13-2013, 04:15 PM
  3. how to make jar file for javafx in eclipse?
    By sandeep43 in forum JavaFX
    Replies: 1
    Last Post: 05-10-2012, 09:44 AM
  4. Eclipse JavaFX Support
    By mlpehlivan in forum Eclipse
    Replies: 1
    Last Post: 03-11-2012, 02:44 PM
  5. Kindly Help me to apply Stylesheet
    By AMATYA-CHANAKYA in forum Advanced Java
    Replies: 0
    Last Post: 03-18-2008, 07:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •