- java.lang.Object
-
- javafx.css.PseudoClass
-
public abstract class PseudoClass extends Object
PseudoClass represents one unique pseudo-class state. Introducing a pseudo-class into a JavaFX class only requires that the methodNode.pseudoClassStateChanged(javafx.css.PseudoClass, boolean)be called when the pseudo-class state changes. Typically, thepseudoClassStateChangedmethod is called from theprotected void invalidated()method of one of the property base classes in thejavafx.beans.propertypackage.Note that if a node has a default pseudo-class state, a horizontal orientation for example,
pseudoClassStateChangedshould be called from the constructor to set the initial state.The following example would allow "xyzzy" to be used as a pseudo-class in a CSS selector.
public boolean isMagic() { return magic.get(); } public BooleanProperty magicProperty() { return magic; } public BooleanProperty magic = new BooleanPropertyBase(false) { @Override protected void invalidated() { pseudoClassStateChanged(MAGIC_PSEUDO_CLASS. get()); } @Override public Object getBean() { return MyControl.this; } @Override public String getName() { return "magic"; } } private static final PseudoClass MAGIC_PSEUDO_CLASS = PseudoClass.getPseudoClass("xyzzy");- Since:
- JavaFX 8.0
-
-
Constructor Summary
Constructors Constructor Description PseudoClass()Constructor for subclasses to call.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static PseudoClassgetPseudoClass(String pseudoClass)Gets thePseudoClassinstance for a given pseudo class name.abstract StringgetPseudoClassName()Gets the name of thePseudoClass.
-
-
-
Method Detail
-
getPseudoClass
public static PseudoClass getPseudoClass(String pseudoClass)
Gets thePseudoClassinstance for a given pseudo class name.Note: There is only one
PseudoClassinstance for a given pseudo class name.- Parameters:
pseudoClass- the name of the pseudo class- Returns:
- the
PseudoClassinstance for a given pseudo class name; It will not returnnull - Throws:
IllegalArgumentException- if pseudoClass parameter isnullor an emptyString
-
getPseudoClassName
public abstract String getPseudoClassName()
Gets the name of thePseudoClass.- Returns:
- the name of the
PseudoClass
-
-