我有一个单窗口JavaFX应用程序,是从JavaFX教程之一创建的.
我正在通过以下功能设置新的窗口内容:
private Initializable replaceSceneContent(final String fxml) throws Exception {
// wczytanie fxml
FXMLLoader loader = new FXMLLoader();
InputStream in = Main.class.getResourceAsStream(fxml);
loader.setBuilderFactory(new JavaFXBuilderFactory());
loader.setLocation(Main.class.getResource(fxml));
AnchorPane page;
try {
page = (AnchorPane) loader.load(in);
} finally {
in.close();
}
Scene scene = new Scene(page, w, h);
stage.setScene(scene);
return (Initializable) loader.getController();
}
Run Code Online (Sandbox Code Playgroud)
但我想从这个fxml文件中选择一个TextFields默认是活动的.这该怎么做?我试图在控制器的初始化方法中调用requestFocus方法,但它不起作用.我没有在AnchorPane类中找到TextField类中的任何合适属性(AnchorPane是fxml控件树的根元素).
我有一个小型的maven项目.我正在尝试通过maven-site-plugin添加生成站点,但它不起作用.当我构建这个项目时,我得到以下错误:
[错误]无法在项目服务器-wms-product上执行目标org.apache.maven.plugins:maven-site-plugin:3.3:site(default-site):SiteToolException:无法从存储库中解析站点描述符:ArtifactResolutionException :无法找到站点描述符:无法传送工件[PARENT-PROJECT]:XML:site_en:1.0.141.1从/到蚀(http://maven.eclipse.org/nexus/content/repositories/testing/):连接到http://maven.eclipse.org拒绝了
我的项目是其他项目的扩展,所以在我的pom.xml中设置了父项目,这不是我的,我不能在那里添加站点配置.
那么有没有机会在网站生成中跳过检查父项目的网站?
我的pom.xml看起来像这样:
<project>
<parent>
<artifactId>base-server-product</artifactId>
<groupId>XXXXXXXXXXXx</groupId>
<version>1.0</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<configuration>
<reportPlugins>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
当然我在src/site中有site.xml文件.