Guest User

Untitled

a guest
May 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. public class ScreenViews {
  2.  
  3. private static HashMap<String, datatype? > controllerMap = new HashMap<>();
  4.  
  5. public static void addController(String name, datatype? controller) {
  6. controllerMap.put(name, controller);
  7. }
  8.  
  9. public static datatype? getController(String name) {
  10. return controllerMap.get(name);
  11. }
  12.  
  13. public static boolean loadFXML(String name, String resource) {
  14. try {
  15. FXMLLoader fxLoader = new FXMLLoader(ScreenViews.class.getResource(resource));
  16. Parent loadedFXML = (Parent) fxLoader.load();
  17. addController(name, fxLoader.getController());
  18. return true;
  19. } catch (IOException e) {
  20. System.out.println(e.getMessage());
  21. return false;
  22. }
  23. }
  24.  
  25. }
Add Comment
Please, Sign In to add comment