Package javafx.css

Class Stylesheet


  • public class Stylesheet
    extends Object
    A stylesheet which can apply properties to a tree of objects. A stylesheet is a collection of zero or more Rules, each of which is applied to each object in the tree. Typically the selector will examine the object to determine whether or not it is applicable, and if so it will apply certain property values to the object.
    Since:
    9
    • Method Detail

      • getUrl

        public String getUrl()
        The URL from which the stylesheet was loaded.
        Returns:
        The URL from which the stylesheet was loaded, or null if the stylesheet was created from an inline style.
      • setOrigin

        public void setOrigin​(StyleOrigin origin)
      • getRules

        public List<Rule> getRules()
      • toString

        public String toString()
        Returns a string representation of this object.
        Overrides:
        toString in class Object
        Returns:
        a string representation of the object.
      • loadBinary

        public static Stylesheet loadBinary​(URL url)
                                     throws IOException
        Load a binary stylesheet file from a input stream.
        Parameters:
        url - the URL from which the stylesheet will be loaded
        Returns:
        the constructed stylesheet
        Throws:
        IOException - the exception
      • convertToBinary

        public static void convertToBinary​(File source,
                                           File destination)
                                    throws IOException
        Convert the .css file referenced by urlIn to binary format and write to urlOut.
        Parameters:
        source - is the JavaFX .css file to convert
        destination - is the file to which the binary conversion is written
        Throws:
        IOException - the exception
        IllegalArgumentException - if either parameter is null, if source and destination are the same, if source cannot be read, or if destination cannot be written.