title: Using custom Controls in fxml
body: <p>Let's say I have subclassed the default <code>TableView&lt;T&gt;</code> class provided by javafx and created a class <code>PersonTableView extends TableView&lt;Person&gt;</code>. That subclass exists in java code and does not use fxml at all. It defines and encapsulates behaviour that I need specifically for my <code>Person</code> object.</p>
  
  <p>Now I want to use an instance of my custom class inside of an fxml file, just like I would use all the default controls. And that exactly is my problem, I don't know how I can do that, or if this is even a good / common design decision.</p>
  
  <p>I want to encapsulate the behaviour for my specific TableView inside its own class, but the layout should be defined in fxml as it has nothing to do with logic, it is only cosmetics.</p>
  
  <p>I imagine a kind of syntax and functionality like it can be found in WPF from .NET, where you can use your custom classes in markup like any other control, because xaml and c# are more tightly coupled than java and fxml.</p>
  
  <p>From my current Point of View, what I described cannot be done and I would instead end up using only a very small amount of fxml and a lot more code, even for the parts that are just layout. For Example I do not want to use code like this:</p>
  
  <pre><code> AnchorPane.setRightAnchor(customControl, 65.0);
  </code></pre>
  
  <p>because I believe that it is a good Idea to have this defined inside my fxml.</p>
  
  <p>So my question is either, how do I implement what was just described above; or, if that is uncommon, what is the common, "best-practice" way to get similar functionality to what I just described?</p>