PseudoClass (Java SE 10 & JDK 10 ) (original) (raw)
- 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, thepseudoClassStateChanged
method is called from theprotected void invalidated()
method of one of the property base classes in the javafx.beans.property
package.
Note that if a node has a default pseudo-class state, a horizontal orientation for example, pseudoClassStateChanged
should 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() Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
Modifier and Type Method Description static PseudoClass getPseudoClass(String pseudoClass) There is only one PseudoClass instance for a given pseudoClass. abstract String getPseudoClassName() * ### Methods declared in class java.lang.[Object](../../java/lang/Object.html "class in java.lang") `[clone](../../java/lang/Object.html#clone%28%29), [equals](../../java/lang/Object.html#equals%28java.lang.Object%29), [finalize](../../java/lang/Object.html#finalize%28%29), [getClass](../../java/lang/Object.html#getClass%28%29), [hashCode](../../java/lang/Object.html#hashCode%28%29), [notify](../../java/lang/Object.html#notify%28%29), [notifyAll](../../java/lang/Object.html#notifyAll%28%29), [toString](../../java/lang/Object.html#toString%28%29), [wait](../../java/lang/Object.html#wait%28%29), [wait](../../java/lang/Object.html#wait%28long%29), [wait](../../java/lang/Object.html#wait%28long,int%29)`
Constructor Detail
* #### PseudoClass public PseudoClass()
Method Detail
* #### getPseudoClass public static [PseudoClass](../../javafx/css/PseudoClass.html "class in javafx.css") getPseudoClass([String](../../java/lang/String.html "class in java.lang") pseudoClass) There is only one PseudoClass instance for a given pseudoClass. Parameters: `pseudoClass` \- the pseudo-class Returns: The PseudoClass for the given pseudoClass. Will not return null. Throws: `[IllegalArgumentException](../../java/lang/IllegalArgumentException.html "class in java.lang")` \- if pseudoClass parameter is null or an empty String * #### getPseudoClassName public abstract [String](../../java/lang/String.html "class in java.lang") getPseudoClassName() Returns: the pseudo-class state
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2018, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.