Class CssParser
java.lang.Object
javafx.css.CssParser
public final class CssParser extends Object
A parser for a CSS document string.
- Since:
- 9
Property Summary
| Type | Property | Description |
|---|---|---|
static ObservableList<CssParser.ParseError> |
errors |
List of errors that may have occurred during CSS processing. |
Nested Class Summary
| Modifier and Type | Class | Description |
|---|---|---|
static class |
CssParser.ParseError |
A class that encapsulates information about the source and nature of errors encountered while parsing CSS or applying styles to Nodes. |
Constructor Summary
| Constructor | Description |
|---|---|
CssParser() |
Constructs a CssParser. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
static ObservableList<CssParser.ParseError> |
errorsProperty() |
List of errors that may have occurred during CSS processing. |
Stylesheet |
parse |
Creates a Stylesheet from a CSS document string. |
Stylesheet |
parse |
Creates a Stylesheet from a CSS document string using docbase as the base URL for resolving references within Stylesheet. |
Stylesheet |
parse |
Updates the given stylesheet by reading a CSS document from a URL, assuming UTF-8 encoding. |
Stylesheet |
parseInlineStyle |
Parse an in-line style from a Node. |
Property Details
errors
public static ObservableList<CssParser.ParseError> errorsProperty
List of errors that may have occurred during CSS processing.
- See Also:
Constructor Details
CssParser
public CssParser()
Constructs a
CssParser.Method Details
parse
public Stylesheet parse(String stylesheetText)
Creates a
Stylesheet from a CSS document string.- Parameters:
-
stylesheetText- the CSS document to parse - Returns:
- the
Stylesheet
parse
public Stylesheet parse(String docbase, String stylesheetText) throws IOException
Creates a
Stylesheet from a CSS document string using docbase as the base URL for resolving references within Stylesheet.- Parameters:
-
docbase- the doc base for resolving URL references -
stylesheetText- the CSS document to parse - Returns:
- the Stylesheet
- Throws:
-
IOException- the exception
parse
public Stylesheet parse(URL url) throws IOException
Updates the given stylesheet by reading a CSS document from a URL, assuming UTF-8 encoding.
- Parameters:
-
url- URL of the stylesheet to parse - Returns:
- the stylesheet
- Throws:
-
IOException- the exception
parseInlineStyle
public Stylesheet parseInlineStyle(Styleable node)
Parse an in-line style from a
Node.- Parameters:
-
node- the styleable node - Returns:
- the style sheet
errorsProperty
public static ObservableList<CssParser.ParseError> errorsProperty()
List of errors that may have occurred during CSS processing.
- Returns:
- an
ObservableListofParseError
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.