Spec-Zone.ru › OpenJavaFX 8
javafx.css

Class PseudoClass

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 method Node.pseudoClassStateChanged(javafx.css.PseudoClass, boolean) be called when the pseudo-class state changes. Typically, the pseudoClassStateChanged method is called from the protected 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 and Description
    PseudoClass()
  • Method Summary

    All MethodsStatic MethodsInstance MethodsAbstract MethodsConcrete Methods
    Modifier and Type Method and Description
    static PseudoClass getPseudoClass(String pseudoClass)
    There is only one PseudoClass instance for a given pseudoClass.
    abstract String getPseudoClassName()
    • Methods inherited from class java.lang.Object

      clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Detail

    • PseudoClass

      public PseudoClass()
  • Method Detail

    • getPseudoClass

      public static PseudoClass getPseudoClass(String pseudoClass)
      There is only one PseudoClass instance for a given pseudoClass.

      Returns:

      The PseudoClass for the given pseudoClass. Will not return null.

      Throws:

      IllegalArgumentException - if pseudoClass parameter is null or an empty String

    • getPseudoClassName

      public abstract String getPseudoClassName()

      Returns:

      the pseudo-class state

© 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.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API