Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java FX 2 CSS Pseudo Classes

How can I create my own CSS pseudo classes in Java FX 2?

So that in CSS file I could use this style

.MyButton : online{ }

In FX 1 it could be done overriding methods like

 public long impl_getPseudoClassState() {}

but they are now deprecated :-(

Is there a new way?

like image 793
DigitWolf Avatar asked Dec 18 '25 23:12

DigitWolf


2 Answers

With the public API of JavaFX 8.0 it is possible to introduce custom css pseudo classes.

  • See: Node#pseudoClassStateChanged(PseudoClass, boolean)
like image 149
Jens Piegsa Avatar answered Dec 21 '25 12:12

Jens Piegsa


Currently you can't do it. Here is what is stated in JavaFX CSS Reference Guide about this:

At this time, the programming interfaces necessary for a class to declare support for CSS properties, to convert and load these values from CSS style sheets into object variables, and to declare and notify changes to an object's pseudo-classes, are considered internal interfaces and are not accessible directly to applications.

like image 25
ndrw Avatar answered Dec 21 '25 12:12

ndrw