title: javafx 2 and css pseudo-classes: setting hover attributes in setStyle method
body: <p>I have a simple Scene with this code:</p>
  
  <pre><code>scene.getStylesheets().add("packagename/testcss.css");
  </code></pre>
  
  <p>And my testcss.css is:</p>
  
  <pre><code>.button { 
      -fx-background-color: #DDFFA4;
  }
  
  .button:hover {
      -fx-background-color: #9ACD32;
  }
  </code></pre>
  
  <p>What i achieve is the nice effect that is aka hover when in web applications.</p>
  
  <p><img src="https://i.stack.imgur.com/RLe33.png" alt="enter image description here">    ...     <img src="https://i.stack.imgur.com/GE4t9.png" alt="enter image description here"></p>
  
  <p><strong>QUESTION</strong><br/>
  How can i achieve the same effect but without a separate css file, just via the setStyle method of my Button?<br/>
  The problem is that setStyle accepts just the style definition and leave out the selector.</p>
  
  <pre><code>button.setStyle("-fx-background-color: #DDFFA4;");
  </code></pre>
  
  <p>The selector, in my hover case is the pseudo-class: </p>
  
  <pre><code>.button:hover
  </code></pre>
  
  <p>but where am I supposed to set it?<br/></p>
  
  <p>Moreover, the javadoc is explicit in excluding the selector from the setStyle method argument: </p>
  
  <blockquote>
    <p>Note that, like the HTML style attribute, this variable contains style
    properties and values and not the selector portion of a style rule.</p>
  </blockquote>