ok, spostando il tutto dentro una classe in quel package funziona.
codice:
package com.mp.fxml;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
public class FXMLUtils {
public static void openWindow(String fileFxml, String title, int width, int height, boolean resiz) throws IOException, ClassNotFoundException {
Parent root = FXMLLoader.load(FXMLUtils.class.getResource(fileFxml));
Stage stage = new Stage();
stage.setTitle(title);
stage.setScene(new Scene(root, width, height));
stage.setResizable(resiz);
stage.show();
}
}
da richiamare così:
codice:
package com.mp.testfx;
import com.mp.fxml.FXMLUtils;
import javafx.fxml.FXML;
import java.io.IOException;
public class ControllerUno {
@FXML
private void onBtnClicked() {
try {
FXMLUtils.openWindow("due.fxml", "due", 500, 500, false);
} catch (IOException | ClassNotFoundException e) {
System.out.println(e.getMessage());
}
}
}
grazie!!