inline fun BorderPane.top(componentType: KClass) { val topComponent : T? = when (T::class) { is View -> find() is Fragment -> findFragment() else -> null } top(topComponent!!.root) }