title: Java FX TitledPane .title CSS Selector
body: <p>In my JavaFX application Im using a <code>TitledPane</code> and overriding the <code>Graphic</code> element to add some special content for my <code>TitledPane</code> header. Kinda works like I would expect. Now Im trying to add some css styling to the header. In the JavaFX CSS reference documentation there is the following definition for a <code>TitledPane</code> structure:</p>
  
  <pre><code>Substructure
  
  title — HBox
  text — Label/li&gt;
  arrow-button — StackPane/li&gt;
  arrow — StackPane
  content — StackPane/li&gt;
  </code></pre>
  
  <p>Therefore I can access styling for the title hbox:</p>
  
  <pre><code>.my-titled-pane &gt; .title {
      -fx-background-color: red;
  }
  </code></pre>
  
  <p>This works too. Now my problem. Im trying to add a specific padding for the title element depending on some code. My current solution looks like that:</p>
  
  <pre><code>[...]
  myTitledPane.getStyleClass().set(0, myTitledPane.getStyleClass.get(0) + getSomeCSSStylingClass());
  [...]
  </code></pre>
  
  <p>In the CSS I defined styles for all different possibilites which are returned by <code>getSomeCSSStylingClass()</code>.</p>
  
  <pre><code>.my-titled-pane-sample-one &gt; .title {
      -fx-padding: 10;
  }
  
  .my-titled-pane-sample-two &gt; .title {
      -fx-padding: 10;
  }
  </code></pre>
  
  <p>But this solution seems horrible. Is there any possibility to do it easier and better? Is there some way to get the <code>.title</code> element and add a styling class to it?</p>
  
  <p>Im using Java Version: Java8_31</p>