Alterar a scene de um stage a partir do controller?

Olá. Eu estou iniciando no JavaFX. Eu fiz um projeto onde eu necessito alterar a scene do meu stage a partir dos controllers.
Eu elaborei a seguinte estrutura:

package com.tkfentretenimento.meusdados.view;

import java.io.IOException;

import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;

public class Install extends Application{

	public static Stage stage;
	
	public static void main(String[] args) {
		launch(args);
	}
	
	public void start(Stage primaryStage) throws Exception {
		stage = primaryStage;
		Pane root = FXMLLoader.load(getClass().getResource("ServiceTerms.fxml"));
		primaryStage.setScene(new Scene(root,500,500));
		primaryStage.setTitle("Registrar-se");
		primaryStage.show();
	}
	
	public static void changeScene(int index) throws IOException{
		Pane root = null;
		switch(index){
		case 0:
			root = FXMLLoader.load(Install.class.getResource("ServiceTerms.fxml"));
		case 1:
			root = FXMLLoader.load(Install.class.getResource("DeviceName.fxml"));
		case 2:
			root = FXMLLoader.load(Install.class.getResource("EnableServices.fxml"));
		case 3:
			root = FXMLLoader.load(Install.class.getResource("CloudServiceSelect.fxml"));
		}
		stage.setScene(new Scene(root,500,500));
	}
	
}

Daí eu chamo o método changeScene a partir dos controllers e passo o index da scene. Porém está sendo gerada esta exceção somente quando eu troco da scene ServiceTerms (essa carrega sem problemas, e todas estão no mesmo pacote junto a classe install (as classes controllers estão em outro pacote)):

Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1774)
	at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
	at javafx.event.Event.fireEvent(Event.java:198)
	at javafx.scene.Node.fireEvent(Node.java:8413)
	at javafx.scene.control.Button.fire(Button.java:185)
	at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
	at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
	at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
	at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.event.Event.fireEvent(Event.java:198)
	at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
	at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
	at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
	at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:381)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(GlassViewEventHandler.java:417)
	at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:416)
	at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
	at com.sun.glass.ui.View.notifyMouse(View.java:937)
	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at sun.reflect.misc.Trampoline.invoke(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
	at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771)
	... 52 more
Caused by: javafx.fxml.LoadException: 
/C:/Users/thall/workspace/Meus-Dados/target/classes/com/tkfentretenimento/meusdados/view/DeviceName.fxml

	at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2571)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
	at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
	at com.tkfentretenimento.meusdados.view.Install.changeScene(Install.java:33)
	at com.tkfentretenimento.meusdados.controller.ServiceTerms.accept(ServiceTerms.java:21)
	... 62 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at sun.reflect.misc.Trampoline.invoke(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2566)
	... 71 more
Caused by: java.lang.NullPointerException
	at com.tkfentretenimento.meusdados.controller.DeviceName.initialize(DeviceName.java:22)
	... 81 more

Olá

Poste o código desta classe DeviceName.java. O erro tána linha 22 dela.

Esta é a classe:

package com.tkfentretenimento.meusdados.controller;

import java.io.IOException;

import com.tkfentretenimento.meusdados.model.ConfigDAO;
import com.tkfentretenimento.meusdados.view.Install;

import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;

public class DeviceName {
	
	@FXML private Button prox;
	@FXML private TextField name;
	
	public void initialize(){
		prox.disableProperty().bind(name.textProperty().isNull());
	}

	@FXML public void next() throws IOException{
		ConfigDAO.setDeviceName(name.getText());
		Install.changeScene(2);
	}
	
	@FXML public void back() throws IOException{
		Install.changeScene(0);
	}


	@FXML public void cancel(){
		Platform.exit();
	}
}

E este é o arquivo DeviceName.fxml:

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.BorderPane?>

<BorderPane xmlns="http://javafx.com/javafx/8.0.102" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.tkfentretenimento.meusdados.controller.DeviceName">
   <top>
      <Label text="Dê um nome a este dispositivo" BorderPane.alignment="CENTER" />
   </top>
   <center>
      <TextField id="name" BorderPane.alignment="CENTER">
         <BorderPane.margin>
            <Insets bottom="20.0" left="20.0" right="20.0" top="20.0" />
         </BorderPane.margin></TextField>
   </center>
   <bottom>
      <ButtonBar prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
        <buttons>
            <Button mnemonicParsing="false" text="Cancelar" onAction="#cancel"/>
            <Button mnemonicParsing="false" text="Anterior" onAction="#back"/>
          <Button id="prox" mnemonicParsing="false" text="Próximo" onAction="#next"/>
        </buttons>
         <BorderPane.margin>
            <Insets right="10.0" />
         </BorderPane.margin>
      </ButtonBar>
   </bottom>
</BorderPane>

O erro está nos id’s:

Há uma grade diferença de:

<Button id="prox" mnemonicParsing="false" text="Próximo" onAction="#next"/>

Para

<Button fx:id="prox" mnemonicParsing="false" text="Próximo" onAction="#next"/>

O atributo id serve para especificar as classes do CSS, já o fx:id serve para o FXMLLoader buscar o node (componente) no seu fxml e instanciá-lo no seu controller.

Siga a imagem abaixo para definir o fx:id, no painel code:

Dessa forma o que ocorreu foi: O FXMLLoader foi instanciar sua classe DeviceName e não encontrou os nodes prox e name no seu fxml, assim os deixou como null. Em seguida no método initialize você tentou utilizar esses componentes e recebeu uma NullPointerException. :+1:

1 curtida

Opa valeu. Não sabia disso. Porém agora está sendo lançada uma exceção diferente:

Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
	at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1774)
	at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1657)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
	at javafx.event.Event.fireEvent(Event.java:198)
	at javafx.scene.Node.fireEvent(Node.java:8413)
	at javafx.scene.control.Button.fire(Button.java:185)
	at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
	at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
	at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
	at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.event.Event.fireEvent(Event.java:198)
	at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
	at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
	at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
	at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:381)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$354(GlassViewEventHandler.java:417)
	at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:416)
	at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
	at com.sun.glass.ui.View.notifyMouse(View.java:937)
	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
	at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at sun.reflect.misc.Trampoline.invoke(Unknown Source)
	at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
	at javafx.fxml.FXMLLoader$MethodHandler.invoke(FXMLLoader.java:1771)
	... 52 more
Caused by: javafx.fxml.LoadException: 
/C:/Users/thall/workspace/Meus-Dados/target/classes/com/tkfentretenimento/meusdados/view/CloudServiceSelect.fxml:13

	at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
	at javafx.fxml.FXMLLoader.access$700(FXMLLoader.java:103)
	at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:922)
	at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:971)
	at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:220)
	at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:744)
	at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
	at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
	at com.tkfentretenimento.meusdados.view.Install.changeScene(Install.java:37)
	at com.tkfentretenimento.meusdados.controller.ServiceTerms.accept(ServiceTerms.java:13)
	... 62 more
Caused by: java.lang.ClassNotFoundException: com.tkfentretenimento.controller.CloudServiceSelect
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:920)
	... 76 more

A classe CloudServiceSelect é esta:

package com.tkfentretenimento.meusdados.controller;

import java.io.IOException;

import com.tkfentretenimento.meusdados.model.ConfigDAO;
import com.tkfentretenimento.meusdados.view.GoogleSignIn;
import com.tkfentretenimento.meusdados.view.Install;

import javafx.application.Platform;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;

public class CloudServiceSelect {

	@FXML private ComboBox<String> combo;
	@FXML private CheckBox check;
	@FXML private Button finish;
	
	public void Initialize(){
		combo.getItems().addAll("Google Drive","Mega");
		finish.disableProperty().bind(combo.selectionModelProperty().isNotEqualTo("-Selecione-"));
	}
	
	@FXML public void cancel(){
		Platform.exit();
	}
	
	@FXML public void finish() throws IOException{
		ConfigDAO.setCloudService(combo.selectionModelProperty().get().getSelectedItem());
		ConfigDAO.setUseFlickr(check.isSelected());
		ConfigDAO.Save();
		Install.stage.close();
		new GoogleSignIn();
	}
	
	@FXML public void back() throws IOException{
		Install.changeScene(2);
	}
	
}

E o arquivo CloudServiceSelect.fxml é este:

<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>

<BorderPane xmlns="http://javafx.com/javafx/8.0.102" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.tkfentretenimento.controller.CloudServiceSelect">
   <top>
      <Label text="Qual serviço você usará?" BorderPane.alignment="CENTER">
         <font>
            <Font name="Arial Bold" size="18.0" />
         </font>
         <BorderPane.margin>
            <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
         </BorderPane.margin>
      </Label>
   </top>
   <bottom>
      <ButtonBar prefHeight="40.0" prefWidth="200.0" BorderPane.alignment="CENTER">
        <buttons>
            <Button fx:id="cancel" mnemonicParsing="false" text="Cancelar" onAction="#cancel"/>
            <Button fx:id="back" mnemonicParsing="false" text="Anterior" onAction="#back"/>
          <Button fx:id="finish" mnemonicParsing="false" text="Finalizar" onAction="#finish"/>
        </buttons>
         <BorderPane.margin>
            <Insets right="10.0" />
         </BorderPane.margin>
      </ButtonBar>
   </bottom>
   <center>
      <VBox alignment="TOP_CENTER" BorderPane.alignment="CENTER">
         <children>
            <ComboBox fx:id="combo" prefWidth="150.0" promptText="-Selecione-"/>
            <CheckBox fx:id="check" mnemonicParsing="false" selected="true" text="Usar o Flickr para arquivos de mídia">
               <VBox.margin>
                  <Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
               </VBox.margin>
            </CheckBox>
         </children>
      </VBox>
   </center>
</BorderPane>

Classe não encontrada

Se você moveu a classe ou alterou o pacote tem que informar isso para o fxml:

fx:controller="com.tkfentretenimento.controller.CloudServiceSelect"

package com.tkfentretenimento.meusdados.controller;
1 curtida

Muito obrigado pela ajuda. Eu nem percebi que faltou um dos nomes no endereço do pacote. Foi tudo carregado perfeitamente agora.