@Override public void start(Stage stage) throws Exception { Parent root = createLayout(); scene = SceneBuilder.create() .fill(new Color(0.5, 0.5, 0.5, 1.0)) .root(root) .width(600) .height(400) .build(); stage.setScene(scene); stage.show(); // Add values to the spinner controls String[] months = new DateFormatSymbols().getMonths(); ObservableList<String> dayList = FXCollections.observableArrayList(); ObservableList<String> monthList = FXCollections.observableArrayList(months); ObservableList<String> yearList = FXCollections.observableArrayList(); for (int i = 1; i <= 31; i++) { dayList.add(Integer.toString(i)); } for (int i = 1970; i <= 2013; i++) { yearList.add(Integer.toString(i)); } spinnerControlDay.setItems(dayList); spinnerControlMonth.setItems(monthList); spinnerControlYear.setItems(yearList); }
@Override public void start(final Stage stage) throws Exception { File workingDir = new File(System.getProperty("loadui.working", ".")).getAbsoluteFile(); Scene splashScene; try { splashScene = FXMLLoader.load(new File(workingDir, "res/loadui-splash.fxml").toURI().toURL()); } catch (IOException e) { splashScene = SceneBuilder.create() .width(600) .height(320) .fill(Color.DARKGRAY) .root(LabelBuilder.create().text(System.getProperty(LOADUI_NAME, "loadUI")).build()) .build(); } Image[] icons = new Image[0]; try { icons = new Image[] { new Image(new File(workingDir, "res/icon_64x64.png").toURI().toURL().toString()), new Image(new File(workingDir, "res/icon_32x32.png").toURI().toURL().toString()) }; } catch (Exception e) { // e.printStackTrace(); } final String noFx = getParameters().getNamed().get(NOFX_OPTION); final String agent = getParameters().getNamed().get("agent"); if ("true".equals(agent)) setDefaultSystemProperty("loadui.instance", "agent"); if ("false".equals(noFx)) { setDefaultSystemProperty("loadui.headless", "false"); final Stage splash = StageBuilder.create() .style(StageStyle.TRANSPARENT) .scene(splashScene) .icons(icons) .build(); splash.initModality(Modality.APPLICATION_MODAL); splash.centerOnScreen(); splash.show(); splash.toFront(); stage.getIcons().addAll(icons); stage.setOnShown( new EventHandler<WindowEvent>() { @Override public void handle(WindowEvent event) { System.out.println("closing splash!"); splash.close(); } }); } System.out.println("start called!"); Task<Void> task = new Task<Void>() { @Override protected Void call() throws Exception { System.setSecurityManager(null); System.out.println("LoadUIFXLauncher: Creating launcher"); launcher = createLauncher(getParameters().getRaw().toArray(new String[0])); System.out.println("LoadUIFXLauncher: Initializing launcher"); launcher.init(); System.out.println("LoadUIFXLauncher: Starting launcher"); launcher.start(); if ("false".equals(noFx)) { launcher .framework .getBundleContext() .registerService(Stage.class, stage, new Hashtable<String, Object>()); } return null; } }; new Thread(task).start(); }