申し訳ありませんが、タイトルがあいまいですが、JavaFX BorderPane クラスで不具合を見つけたと思いますが、肯定的ではありません。だから私がやっていることは、スレッド内にある javaFx Concurrent Task オブジェクト内でこのメソッドを実行することです。このメソッドは、print ステートメントに到達するまでずっと機能します。1 を出力し、root.setCenter メソッドを通過しません。そのコードをコメントアウトすると、それは続行します。そうしないと、無限ループにあるようにスタックします。ルート (ボーダーペイン オブジェクト) は、JavaFX メイン スレッド内にローカルに格納されることに注意してください。提案をありがとう。
// will be used to store all the sites we still need to visit so we can do
// a breadth first graph traversal of the hostsite
Queue<URL> unvistedURLs = new LinkedList<>();
LinkedList<Text> currentLevelText = new LinkedList<>();
Queue<URL> levelCheckpoints = new LinkedList<>();
int currentLevelHieght = 0;
// the origional host
String hostName = origin.getHost();
// temporary objects
HTMLLinks endHTMLLinks = null;
try
{
endHTMLLinks = new HTMLLinks(origin);
}
catch (IOException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
HostSiteInfo hostSiteInfo = new HostSiteInfo();
URL currentURL;
Group displayArea = new Group();
System.out.println(1);
root.setCenter(displayArea);
System.out.println(2);
// imediatley input the host as a site we need to visit
unvistedURLs.add(origin);
levelCheckpoints.offer(origin);
@Override
public void start(Stage primaryStage)
{
try
{
final BorderPane root = new BorderPane();
Scene scene = new Scene(root, 1600, 1000);
@SuppressWarnings("rawtypes")
Thread renderThread = new Thread(new Task(){
@Override
protected Object call() throws Exception
{
try
{
WebSpider.traverseURLs(root,
new URL("http://www.georgefox.edu/"),
new PrintStream(System.out));
}
catch (MalformedURLException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}});
renderThread.setDaemon(true);
renderThread.start();
JavaFx アプリのルートは、この開始メソッドで初期化されます。