4

Is there a way to do something similar to "not([name="selector"]) " in JavaFX?
I have a VBox with a styleClass and I want to style its components except for one of them which is indexed by a specific selector, here's approximately what I want to do:

.class:not([name="idButton"]){
  -fx-opacity :30%;
 }

but this css code doesn't work.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
otmane42
  • 535
  • 4
  • 11
  • 1
    nope. The attribute selector is also not available btw. You could override the style with a rule that has higher precedence though: `#idButton { -fx-opacity: 1; }` – fabian Mar 08 '18 at 00:55
  • I concur with fabian. Create one rule for `.class` to set all to certain style, then use a specific selector `.class#idButton` to override the exceptional ones. – Jai Mar 08 '18 at 01:45
  • well I've tried to override its style with this method too, and everything looks good with other properties like "font-size" but not with the opacity, I think that the CSS related with the javafx don't have all the properties that are usually found in the css3 – otmane42 Mar 08 '18 at 08:49
  • If the parent has an individual opacity of 30%, and the child has an individual opacity of 100%, then the effective opacity of the child is .3 * 1.0 = .3 (or 30%). It is not possible for the child to be more opaque than the parent. The parent opacity affects the opacity of the child. If you want the node to have a different opacity than an enclosing node, then you need to make it have a different parent. See [How to implement a transparent Pane with non-transparent children?](https://stackoverflow.com/questions/12717487/how-to-implement-a-transparent-pane-with-non-transparent-children). – jewelsea Mar 08 '18 at 23:19

0 Answers0