private static < M extends Model > URL convertFxmlUrl ( final M model , final String fxmlPath ) { URL fxmlUrl = null ; // Replace all '.' separator by path separator '/' if ( model != null ) { // Try to load the resource from the same path as the model class fxmlUrl = model . getClass ( ) . getResource ( fxmlPath ) ; } if ( fxmlUrl == null ) { // Try to load the resource from the full path org/jrebirth/core/ui/Test.fxml fxmlUrl = Thread . currentThread ( ) . getContextClassLoader ( ) . getResource ( fxmlPath ) ; } return fxmlUrl ; }
Convert The url of fxml files to allow local and path loading .