Example usage for javafx.scene.layout StackPane StackPane

List of usage examples for javafx.scene.layout StackPane StackPane

Introduction

In this page you can find the example usage for javafx.scene.layout StackPane StackPane.

Prototype

public StackPane() 

Source Link

Document

Creates a StackPane layout with default CENTER alignment.

Usage

From source file:gov.va.isaac.gui.util.ErrorMarkerUtils.java

/**
 * A convenience method that sets up a new error marker using {@link #swapGridPaneComponents(Node, StackPane, GridPane)} and 
 * {@link #setupErrorMarker(Node, StackPane, ValidBooleanBinding)} 
 * @param prePlacedNode//from  w  w w.j ava  2s.co m
 * @param whereToPlace
 * @param isNodeCurrentlyValid
 */
public static void setupErrorMarkerAndSwap(Node prePlacedNode, GridPane whereToPlace,
        ValidBooleanBinding isNodeCurrentlyValid) {
    StackPane newStack = new StackPane();
    swapGridPaneComponents(prePlacedNode, newStack, whereToPlace);
    setupErrorMarker(prePlacedNode, newStack, isNodeCurrentlyValid);
}

From source file:uk.co.everywheremusic.viewcontroller.SetupScene.java

private void startSetupWindow(Stage primaryStage) {
    try {//from  ww w.  j  a  v  a 2 s.  co  m
        installFolder = new File(".").getCanonicalPath() + Globals.INSTALL_EXT;
    } catch (IOException ex) {
        Logger.getLogger(SetupScene.class.getName()).log(Level.SEVERE, null, ex);
        installFolder = System.getProperty("user.dir") + Globals.INSTALL_EXT;
    }

    primaryStage.setTitle(Globals.APP_NAME);

    grid = new GridPane();
    grid.setAlignment(Pos.CENTER);
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(25, 25, 25, 25));

    column1 = new ColumnConstraints(100, 100, Double.MAX_VALUE);
    column1.setHgrow(Priority.ALWAYS);
    column2 = new ColumnConstraints(100, 100, Double.MAX_VALUE);
    column2.setHgrow(Priority.ALWAYS);
    column3 = new ColumnConstraints(100, 100, Double.MAX_VALUE);
    column3.setHgrow(Priority.ALWAYS);
    column4 = new ColumnConstraints(100, 100, Double.MAX_VALUE);
    column4.setHgrow(Priority.ALWAYS);
    grid.getColumnConstraints().addAll(column1, column2, column3, column4);

    sceneTitle = new Label(Globals.SETUP_FRAME_TITLE);
    sceneTitle.setId(Globals.CSS_TITLE_ID);
    sceneTitle.setPrefWidth(Double.MAX_VALUE);
    sceneTitle.setAlignment(Pos.CENTER);

    ImageView imageView = null;
    try {

        imageView = new ImageView();
        String img = new File(Globals.IC_LOGO).toURI().toURL().toString();
        imgLogo = new Image(img);

        imageView.setImage(imgLogo);

    } catch (MalformedURLException ex) {
        Logger.getLogger(ServerScene.class.getName()).log(Level.SEVERE, null, ex);
    }

    GridPane titlePane = new GridPane();
    ColumnConstraints c1 = new ColumnConstraints(50);
    ColumnConstraints c2 = new ColumnConstraints(400);
    titlePane.getColumnConstraints().addAll(c1, c2);
    titlePane.add(imageView, 0, 0);
    titlePane.add(sceneTitle, 1, 0);
    titlePane.setAlignment(Pos.CENTER);
    grid.add(titlePane, 0, 0, 4, 1);

    lblFolder = new Label(Globals.SETUP_LBL_MUSIC_FOLDER);
    grid.add(lblFolder, 0, 2, 3, 1);

    txtFolder = new TextField();
    txtFolder.setText("/home/kyle/Music/Test music");
    grid.add(txtFolder, 0, 3, 3, 1);

    btnFolder = new Button(Globals.SETUP_BTN_MUSIC_FOLDER);
    btnFolder.setPrefWidth(Double.MAX_VALUE);
    grid.add(btnFolder, 3, 3);

    final DirectoryChooser dirChooser = new DirectoryChooser();

    btnFolder.setOnAction((ActionEvent event) -> {
        File dir = dirChooser.showDialog(primaryStage);
        if (dir != null) {
            txtFolder.setText(dir.getAbsolutePath());
        }
    });

    lblPassword = new Label("Choose a password:");
    grid.add(lblPassword, 0, 4, 2, 1);

    lblConfirmPassword = new Label("Confirm your password:");
    grid.add(lblConfirmPassword, 2, 4, 2, 1);

    txtPassword = new PasswordField();
    grid.add(txtPassword, 0, 5, 2, 1);

    txtConfirmPassword = new PasswordField();
    grid.add(txtConfirmPassword, 2, 5, 1, 1);

    textArea = new TextArea();
    textArea.setPrefHeight(Double.MAX_VALUE);
    textArea.setDisable(true);
    textArea.setWrapText(true);
    grid.add(textArea, 0, 7, 4, 2);

    StackPane progressPane = new StackPane();
    lblProgress = new Label(Globals.SETUP_LBL_PERCENT);
    lblProgress.setId(Globals.CSS_PROGBAR_LBL_ID);
    lblProgress.setVisible(false);
    progressBar = new ProgressBar(0);
    progressBar.setPrefWidth(Double.MAX_VALUE);
    progressBar.setVisible(false);
    progressPane.getChildren().addAll(progressBar, lblProgress);
    progressPane.setAlignment(Pos.CENTER_RIGHT);
    grid.add(progressPane, 0, 11, 3, 1);

    StackPane buttonPane = new StackPane();
    btnInstall = new Button(Globals.SETUP_BTN_INSTALL);
    btnInstall.setPrefWidth(Double.MAX_VALUE);
    btnDone = new Button(Globals.SETUP_BTN_DONE);
    btnDone.setPrefWidth(Double.MAX_VALUE);
    btnDone.setVisible(false);
    buttonPane.getChildren().addAll(btnInstall, btnDone);
    grid.add(buttonPane, 3, 11);

    btnInstall.setOnAction((ActionEvent event) -> {

        boolean valid = validateForm();
        if (valid) {

            lblFolder.setDisable(true);
            txtFolder.setDisable(true);
            btnFolder.setDisable(true);
            lblPassword.setDisable(true);
            txtPassword.setDisable(true);
            lblConfirmPassword.setDisable(true);
            txtConfirmPassword.setDisable(true);

            textArea.setDisable(false);
            lblProgress.setVisible(true);
            progressBar.setVisible(true);
            btnInstall.setDisable(true);

            musicFolder = txtFolder.getText();
            password = txtPassword.getText();

            setupWorker = createSetupWorker();
            progressBar.progressProperty().unbind();
            progressBar.progressProperty().bind(setupWorker.progressProperty());

            setupWorker.messageProperty().addListener(
                    (ObservableValue<? extends String> observable, String oldValue, String newValue) -> {
                        String[] values = newValue.split("\\|");
                        lblProgress.setText(values[0] + "%");
                        textArea.appendText(values[1] + "\n");

                        if (values[1].equals(Globals.SETUP_MSG_DONE)) {
                            btnInstall.setVisible(false);
                            btnDone.setVisible(true);
                        }

                    });

            new Thread(setupWorker).start();

        }
    });

    btnDone.setOnAction((ActionEvent event) -> {
        primaryStage.hide();
        new ServerScene(installFolder, musicFolder).showWindow(new Stage());
    });

    try {
        String imgUrl = new File(Globals.IC_LOGO).toURI().toURL().toString();
        javafx.scene.image.Image i = new javafx.scene.image.Image(imgUrl);
        primaryStage.getIcons().add(i);
    } catch (MalformedURLException ex) {
        Logger.getLogger(ServerScene.class.getName()).log(Level.SEVERE, null, ex);
    }

    scene = new Scene(grid, 600, 400);
    primaryStage.setScene(scene);

    scene.getStylesheets().add(SetupScene.class.getResource(Globals.CSS_FILE).toExternalForm());
    //  grid.setGridLinesVisible(true);
    primaryStage.show();
}

From source file:Testing.TestMain.java

public static void treeSample(Stage stage, Collection root) {
    TreeItem<String> rootItem = new TreeItem<String>("D:\\");

    rootItem.setExpanded(true);// w  ww.j a  va2 s.  c  om

    for (Iterator it = root.iterator(); it.hasNext();) {
        Object i = it.next();
        TreeItem<String> item = new TreeItem<String>(i.toString());
        rootItem.getChildren().add(item);
    }
    /*
     for (int i = 1; i < 6; i++) {
     TreeItem<String> item = new TreeItem<String>("Message" + i);
     rootItem.getChildren().add(item);
     }*/
    TreeView<String> tree = new TreeView<String>(rootItem);
    StackPane rootpane = new StackPane();
    rootpane.getChildren().add(tree);
    stage.setScene(new Scene(rootpane, 300, 250));
    stage.show();
}

From source file:gov.va.isaac.gui.ConceptNode.java

/**
 * descriptionReader is optional/* ww  w . j  a  va2s .co m*/
 */
public ConceptNode(ConceptVersionBI initialConcept, boolean flagAsInvalidWhenBlank,
        ObservableList<SimpleDisplayConcept> dropDownOptions,
        Function<ConceptVersionBI, String> descriptionReader) {
    c_ = initialConcept;
    //We can't simply use the ObservableList from the CommonlyUsedConcepts, because it infinite loops - there doesn't seem to be a way 
    //to change the items in the drop down without changing the selection.  So, we have this hack instead.
    listChangeListener_ = new ListChangeListener<SimpleDisplayConcept>() {
        @Override
        public void onChanged(Change<? extends SimpleDisplayConcept> c) {
            //TODO I still have an infinite loop here.  Find and fix.
            logger.debug("updating concept dropdown");
            disableChangeListener_ = true;
            SimpleDisplayConcept temp = cb_.getValue();
            cb_.setItems(FXCollections.observableArrayList(dropDownOptions_));
            cb_.setValue(temp);
            cb_.getSelectionModel().select(temp);
            disableChangeListener_ = false;
        }
    };
    descriptionReader_ = (descriptionReader == null ? (conceptVersion) -> {
        return conceptVersion == null ? "" : OTFUtility.getDescription(conceptVersion);
    } : descriptionReader);
    dropDownOptions_ = dropDownOptions == null
            ? AppContext.getService(CommonlyUsedConcepts.class).getObservableConcepts()
            : dropDownOptions;
    dropDownOptions_.addListener(new WeakListChangeListener<SimpleDisplayConcept>(listChangeListener_));
    conceptBinding_ = new ObjectBinding<ConceptVersionBI>() {
        @Override
        protected ConceptVersionBI computeValue() {
            return c_;
        }
    };

    flagAsInvalidWhenBlank_ = flagAsInvalidWhenBlank;
    cb_ = new ComboBox<>();
    cb_.setConverter(new StringConverter<SimpleDisplayConcept>() {
        @Override
        public String toString(SimpleDisplayConcept object) {
            return object == null ? "" : object.getDescription();
        }

        @Override
        public SimpleDisplayConcept fromString(String string) {
            return new SimpleDisplayConcept(string, 0);
        }
    });
    cb_.setValue(new SimpleDisplayConcept("", 0));
    cb_.setEditable(true);
    cb_.setMaxWidth(Double.MAX_VALUE);
    cb_.setPrefWidth(ComboBox.USE_COMPUTED_SIZE);
    cb_.setMinWidth(200.0);
    cb_.setPromptText("Type, drop or select a concept");

    cb_.setItems(FXCollections.observableArrayList(dropDownOptions_));
    cb_.setVisibleRowCount(11);

    cm_ = new ContextMenu();

    MenuItem copyText = new MenuItem("Copy Description");
    copyText.setGraphic(Images.COPY.createImageView());
    copyText.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            CustomClipboard.set(cb_.getEditor().getText());
        }
    });
    cm_.getItems().add(copyText);

    CommonMenusNIdProvider nidProvider = new CommonMenusNIdProvider() {
        @Override
        public Set<Integer> getNIds() {
            Set<Integer> nids = new HashSet<>();
            if (c_ != null) {
                nids.add(c_.getNid());
            }
            return nids;
        }
    };
    CommonMenuBuilderI menuBuilder = CommonMenus.CommonMenuBuilder.newInstance();
    menuBuilder.setInvisibleWhenFalse(isValid);
    CommonMenus.addCommonMenus(cm_, menuBuilder, nidProvider);

    cb_.getEditor().setContextMenu(cm_);

    updateGUI();

    new LookAheadConceptPopup(cb_);

    if (cb_.getValue().getNid() == 0) {
        if (flagAsInvalidWhenBlank_) {
            isValid.setInvalid("Concept Required");
        }
    } else {
        isValid.setValid();
    }

    cb_.valueProperty().addListener(new ChangeListener<SimpleDisplayConcept>() {
        @Override
        public void changed(ObservableValue<? extends SimpleDisplayConcept> observable,
                SimpleDisplayConcept oldValue, SimpleDisplayConcept newValue) {
            if (newValue == null) {
                logger.debug("Combo Value Changed - null entry");
            } else {
                logger.debug("Combo Value Changed: {} {}", newValue.getDescription(), newValue.getNid());
            }

            if (disableChangeListener_) {
                logger.debug("change listener disabled");
                return;
            }

            if (newValue == null) {
                //This can happen if someone calls clearSelection() - it passes in a null.
                cb_.setValue(new SimpleDisplayConcept("", 0));
                return;
            } else {
                if (newValue.shouldIgnoreChange()) {
                    logger.debug("One time change ignore");
                    return;
                }
                //Whenever the focus leaves the combo box editor, a new combo box is generated.  But, the new box will have 0 for an id.  detect and ignore
                if (oldValue != null && oldValue.getDescription().equals(newValue.getDescription())
                        && newValue.getNid() == 0) {
                    logger.debug("Not a real change, ignore");
                    newValue.setNid(oldValue.getNid());
                    return;
                }
                lookup();
            }
        }
    });

    AppContext.getService(DragRegistry.class).setupDragAndDrop(cb_, new SingleConceptIdProvider() {
        @Override
        public String getConceptId() {
            return cb_.getValue().getNid() + "";
        }
    }, true);

    pi_ = new ProgressIndicator(ProgressIndicator.INDETERMINATE_PROGRESS);
    pi_.visibleProperty().bind(isLookupInProgress_);
    pi_.setPrefHeight(16.0);
    pi_.setPrefWidth(16.0);
    pi_.setMaxWidth(16.0);
    pi_.setMaxHeight(16.0);

    lookupFailImage_ = Images.EXCLAMATION.createImageView();
    lookupFailImage_.visibleProperty().bind(isValid.not().and(isLookupInProgress_.not()));
    Tooltip t = new Tooltip();
    t.textProperty().bind(isValid.getReasonWhyInvalid());
    Tooltip.install(lookupFailImage_, t);

    StackPane sp = new StackPane();
    sp.setMaxWidth(Double.MAX_VALUE);
    sp.getChildren().add(cb_);
    sp.getChildren().add(lookupFailImage_);
    sp.getChildren().add(pi_);
    StackPane.setAlignment(cb_, Pos.CENTER_LEFT);
    StackPane.setAlignment(lookupFailImage_, Pos.CENTER_RIGHT);
    StackPane.setMargin(lookupFailImage_, new Insets(0.0, 30.0, 0.0, 0.0));
    StackPane.setAlignment(pi_, Pos.CENTER_RIGHT);
    StackPane.setMargin(pi_, new Insets(0.0, 30.0, 0.0, 0.0));

    hbox_ = new HBox();
    hbox_.setSpacing(5.0);
    hbox_.setAlignment(Pos.CENTER_LEFT);

    hbox_.getChildren().add(sp);
    HBox.setHgrow(sp, Priority.SOMETIMES);
}

From source file:calendarioSeries.vistas.MainViewController.java

public void populateImagenes() {
    Platform.runLater(new Runnable() {
        @Override// w  w  w.  j  a va  2s  .  c o  m
        public void run() {
            imagenes.getChildren().clear();
            for (Serie serie : series) {
                //System.out.println(serie.getLastVisto());
                try {
                    Image image = new Image(serie.getUrlImagen());
                    ImageView poster = new ImageView();
                    ContextMenu menu = new ContextMenu();
                    //String css = MainApp.class.getResource("resources/MainTheme.css").toExternalForm();
                    MenuItem delete = new MenuItem("Eliminar");
                    delete.setId(serie.getId());
                    delete.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent event) {
                            menu.hide();
                            MenuItem clicked = (MenuItem) event.getSource();
                            String toDelete = clicked.getId();
                            for (Serie serie : series) {
                                if (serie.getId().equals(toDelete)) {
                                    series.remove(serie);
                                    populateImagenes();
                                    showDetallesMes(mesActual);
                                }
                            }
                            event.consume();
                        }
                    });

                    menu.getItems().add(delete);

                    poster.setId(serie.getTitulo());
                    poster.setImage(image);
                    poster.setCache(true);
                    // poster.setPreserveRatio(true);
                    poster.setFitWidth(210);
                    poster.setFitHeight(300);
                    poster.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() {
                        @Override
                        public void handle(ContextMenuEvent event) {
                            menu.show(poster, event.getScreenX(), event.getScreenY());
                            //menu.getScene().getRoot().getStylesheets().add(css);
                            event.consume();
                        }
                    });
                    poster.setOnMouseClicked(new EventHandler<MouseEvent>() {
                        @Override
                        public void handle(MouseEvent event) {
                            if (event.getButton() == MouseButton.PRIMARY) {
                                try {
                                    //serieToPass = serie;
                                    sceneToPass = mainApp.scene;

                                    FXMLLoader loader = new FXMLLoader(
                                            getClass().getResource("DetailsSerieController.fxml"));
                                    Parent root = loader.load();
                                    DetailsSerieController controller = loader.getController();
                                    controller.setData(serie, series);
                                    controller.setMainApp(mainApp);

                                    Scene scene = new Scene(root);
                                    mainApp.primaryStage.setScene(scene);
                                    mainApp.primaryStage.show();
                                } catch (IOException ex) {
                                    ex.printStackTrace();
                                }
                            }
                        }

                    });
                    imagenes.getChildren().add(poster);
                } catch (IllegalArgumentException e) {
                    Image image = new Image("file:src/calendarioSeries/resources/no-image.png");
                    ImageView poster = new ImageView();
                    ContextMenu menu = new ContextMenu();
                    MenuItem delete = new MenuItem("Eliminar");
                    delete.setId(serie.getId());
                    delete.setOnAction(new EventHandler<ActionEvent>() {
                        @Override
                        public void handle(ActionEvent event) {
                            menu.hide();
                            MenuItem clicked = (MenuItem) event.getSource();
                            String toDelete = clicked.getId();
                            for (Serie serie : series) {
                                if (serie.getId().equals(toDelete)) {
                                    series.remove(serie);
                                    populateImagenes();
                                    showDetallesMes(mesActual);
                                }
                            }
                            event.consume();
                        }
                    });

                    menu.getItems().add(delete);

                    poster.setId(serie.getTitulo());
                    poster.setImage(image);
                    poster.setCache(true);
                    //poster.setPreserveRatio(true);
                    poster.setFitWidth(210);
                    poster.setFitHeight(300);
                    poster.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() {
                        @Override
                        public void handle(ContextMenuEvent event) {
                            menu.show(poster, event.getScreenX(), event.getScreenY());
                            event.consume();
                        }
                    });
                    Text text = new Text(serie.getTitulo());
                    text.getStyleClass().add("label");
                    StackPane pane = new StackPane();
                    pane.getChildren().addAll(poster, text);

                    imagenes.getChildren().add(pane);
                } finally {
                    rellenarArchivo();
                }
            }
        }
    });

}

From source file:jp.ac.tohoku.ecei.sb.metabolome.lims.gui.MainWindowController.java

@FXML
void onShowCompoundIntensity(MouseEvent event) {
    if (tableCompound.getSelectionModel().isEmpty())
        return;/*ww w. j  a v a 2  s. c o  m*/
    for (CompoundImpl compound : tableCompound.getSelectionModel().getSelectedItems()) {
        JFreeChart chart = getChartForCompound(compound);

        StackPane stackPane = new StackPane();
        ChartCanvas chartCanvas = new ChartCanvas(chart);
        stackPane.getChildren().add(chartCanvas);
        chartCanvas.widthProperty().bind(stackPane.widthProperty());
        chartCanvas.heightProperty().bind(stackPane.heightProperty());

        Scene scene = new Scene(stackPane);
        Stage stage = new Stage(StageStyle.UTILITY);
        stage.setScene(scene);
        stage.setWidth(800);
        stage.setHeight(600);
        stage.setTitle(compound.toString());
        stage.show();
    }
}

From source file:io.bitsquare.app.BitsquareApp.java

private void showErrorPopup(Throwable throwable, boolean doShutDown) {
    if (!shutDownRequested) {
        if (scene == null) {
            log.warn(/*from w ww. j av a  2  s  . co m*/
                    "Scene not available yet, we create a new scene. The bug might be caused by an exception in a constructor or by a circular dependency in guice.");
            scene = new Scene(new StackPane(), 1000, 650);
            scene.getStylesheets().setAll("/io/bitsquare/gui/bitsquare.css", "/io/bitsquare/gui/images.css");
            primaryStage.setScene(scene);
            primaryStage.show();
        }
        try {
            try {
                if (!popupOpened) {
                    String message = throwable.getMessage();
                    popupOpened = true;
                    if (message != null)
                        new Popup().error(message).onClose(() -> popupOpened = false).show();
                    else
                        new Popup().error(throwable.toString()).onClose(() -> popupOpened = false).show();
                }
            } catch (Throwable throwable3) {
                log.error("Error at displaying Throwable.");
                throwable3.printStackTrace();
            }
            if (doShutDown)
                stop();
        } catch (Throwable throwable2) {
            // If printStackTrace cause a further exception we don't pass the throwable to the Popup.
            Dialogs.create().owner(primaryStage).title("Error").message(throwable.toString())
                    .masthead("A fatal exception occurred at startup.").showError();
            if (doShutDown)
                stop();
        }
    }
}

From source file:org.jevis.jeconfig.JEConfig.java

/**
 * Build an new JEConfig Login and main frame/stage
 *
 * @param primaryStage//w  w  w .  j ava2  s  .c  om
 */
//@AITBilal - Dieses Method wird nirgendwo aufgerufen!
private void buildGUI(Stage primaryStage) {

    try {

        LoginDialog loginD = new LoginDialog();
        //            ds = loginD.showSQL(primaryStage, _config.get<LoginIcon());

        ds = loginD.showSQL(primaryStage);//Default
        //            ds = loginD.showSQL(primaryStage, _config.getLoginIcon(), _config.getEnabledSSL(), _config.getShowServer(), _config.getDefaultServer());//KAUST
        //            ds = loginD.showSQL(primaryStage, _config.getLoginIcon(), _config.getEnabledSSL(), _config.getShowServer(), _config.getDefaultServer());//Coffee

        //            while (ds == null) {
        //                Thread.sleep(100);
        //            }
        //            if (ds == null) {
        //                System.exit(0);
        //            }
        //            System.exit(1);
        //            ds = new JEVisDataSourceSQL("192.168.2.55", "3306", "jevis", "jevis", "jevistest", "Sys Admin", "jevis");
        //            ds.connect("Sys Admin", "jevis");
    } catch (Exception ex) {
        Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
        ExceptionDialog dia = new ExceptionDialog();
        dia.show(primaryStage, "Error", "Could not connect to Server", ex, PROGRAMM_INFO);
    }

    _mainDS = ds;

    JEConfig.PROGRAMM_INFO.setJEVisAPI(ds.getInfo());
    JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.commons.application.Info.INFO);
    JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.application.Info.INFO);

    PluginManager pMan = new PluginManager(ds);
    GlobalToolBar toolbar = new GlobalToolBar(pMan);
    pMan.addPluginsByUserSetting(null);

    StackPane root = new StackPane();
    root.setId("mainpane");

    BorderPane border = new BorderPane();
    VBox vbox = new VBox();
    vbox.getChildren().addAll(new TopMenu(), toolbar.ToolBarFactory());
    border.setTop(vbox);
    border.setCenter(pMan.getView());

    Statusbar statusBar = new Statusbar(ds);

    border.setBottom(statusBar);

    root.getChildren().addAll(border);

    Scene scene = new Scene(root, 300, 250);
    scene.getStylesheets().add("/styles/Styles.css");
    primaryStage.getIcons().add(getImage("1393354629_Config-Tools.png"));
    primaryStage.setTitle("JEConfig");
    primaryStage.setScene(scene);
    maximize(primaryStage);
    primaryStage.show();

    try {
        //            WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://coffee-project.eu/"));
        //            WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://openjevis.org/projects/openjevis/wiki/JEConfig3#JEConfig-Version-3"));
        WelcomePage welcome = new WelcomePage(primaryStage, _config.getWelcomeURL());

    } catch (URISyntaxException ex) {
        Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
    } catch (MalformedURLException ex) {
        Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
    }

    //Disable GUI is StatusBar note an disconnect
    root.disableProperty().bind(statusBar.connectedProperty.not());

    primaryStage.onCloseRequestProperty().addListener(new ChangeListener<EventHandler<WindowEvent>>() {

        @Override
        public void changed(ObservableValue<? extends EventHandler<WindowEvent>> ov,
                EventHandler<WindowEvent> t, EventHandler<WindowEvent> t1) {
            try {
                System.out.println("Disconnect");
                ds.disconnect();
            } catch (JEVisException ex) {
                Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    });

}

From source file:com.panemu.tiwulfx.table.TableControl.java

private void initControls() {
    this.getStyleClass().add("table-control");
    btnAdd = buildButton(TiwulFXUtil.getGraphicFactory().createAddGraphic());
    btnDelete = buildButton(TiwulFXUtil.getGraphicFactory().createDeleteGraphic());
    btnEdit = buildButton(TiwulFXUtil.getGraphicFactory().createEditGraphic());
    btnExport = buildButton(TiwulFXUtil.getGraphicFactory().createExportGraphic());
    btnReload = buildButton(TiwulFXUtil.getGraphicFactory().createReloadGraphic());
    btnSave = buildButton(TiwulFXUtil.getGraphicFactory().createSaveGraphic());

    btnFirstPage = new Button();
    btnFirstPage.setGraphic(TiwulFXUtil.getGraphicFactory().createPageFirstGraphic());
    btnFirstPage.setOnAction(paginationHandler);
    btnFirstPage.setDisable(true);//from www.  j  a va  2  s. com
    btnFirstPage.setFocusTraversable(false);
    btnFirstPage.getStyleClass().addAll("pill-button", "pill-button-left");

    btnPrevPage = new Button();
    btnPrevPage.setGraphic(TiwulFXUtil.getGraphicFactory().createPagePrevGraphic());
    btnPrevPage.setOnAction(paginationHandler);
    btnPrevPage.setDisable(true);
    btnPrevPage.setFocusTraversable(false);
    btnPrevPage.getStyleClass().addAll("pill-button", "pill-button-center");

    btnNextPage = new Button();
    btnNextPage.setGraphic(TiwulFXUtil.getGraphicFactory().createPageNextGraphic());
    btnNextPage.setOnAction(paginationHandler);
    btnNextPage.setDisable(true);
    btnNextPage.setFocusTraversable(false);
    btnNextPage.getStyleClass().addAll("pill-button", "pill-button-center");

    btnLastPage = new Button();
    btnLastPage.setGraphic(TiwulFXUtil.getGraphicFactory().createPageLastGraphic());
    btnLastPage.setOnAction(paginationHandler);
    btnLastPage.setDisable(true);
    btnLastPage.setFocusTraversable(false);
    btnLastPage.getStyleClass().addAll("pill-button", "pill-button-right");

    cmbPage = new ComboBox<>();
    cmbPage.setEditable(true);
    cmbPage.setOnAction(paginationHandler);
    cmbPage.setFocusTraversable(false);
    cmbPage.setDisable(true);
    cmbPage.getStyleClass().addAll("combo-page");
    cmbPage.setPrefWidth(75);

    paginationBox = new HBox();
    paginationBox.setAlignment(Pos.CENTER);
    paginationBox.getChildren().addAll(btnFirstPage, btnPrevPage, cmbPage, btnNextPage, btnLastPage);

    spacer = new Region();
    HBox.setHgrow(spacer, Priority.ALWAYS);
    toolbar = new ToolBar(btnReload, btnAdd, btnEdit, btnSave, btnDelete, btnExport, spacer, paginationBox);
    toolbar.getStyleClass().add("table-toolbar");

    footer = new StackPane();
    footer.getStyleClass().add("table-footer");
    lblRowIndex = new Label();
    lblTotalRow = new Label();
    menuButton = new TableControlMenu(this);
    StackPane.setAlignment(lblRowIndex, Pos.CENTER_LEFT);
    StackPane.setAlignment(lblTotalRow, Pos.CENTER);
    StackPane.setAlignment(menuButton, Pos.CENTER_RIGHT);

    lblTotalRow.visibleProperty().bind(progressIndicator.visibleProperty().not());

    progressIndicator.setProgress(-1);
    progressIndicator.visibleProperty().bind(service.runningProperty());
    toolbar.disableProperty().bind(service.runningProperty());
    menuButton.disableProperty().bind(service.runningProperty());

    footer.getChildren().addAll(lblRowIndex, lblTotalRow, menuButton, progressIndicator);
    VBox.setVgrow(tblView, Priority.ALWAYS);
    getChildren().addAll(toolbar, tblView, footer);

}

From source file:io.bitsquare.app.BitsquareApp.java

private void showFPSWindow() {
    Label label = new Label();
    EventStreams.animationTicks().latestN(100).map(ticks -> {
        int n = ticks.size() - 1;
        return n * 1_000_000_000.0 / (ticks.get(n) - ticks.get(0));
    }).map(d -> String.format("FPS: %.3f", d)).feedTo(label.textProperty());

    Pane root = new StackPane();
    root.getChildren().add(label);/*  w  w w.j av a  2  s . co  m*/
    Stage stage = new Stage();
    stage.setScene(new Scene(root));
    stage.setTitle("FPS");
    stage.initModality(Modality.NONE);
    stage.initStyle(StageStyle.UTILITY);
    stage.initOwner(scene.getWindow());
    stage.setX(primaryStage.getX() + primaryStage.getWidth() + 10);
    stage.setY(primaryStage.getY());
    stage.setWidth(200);
    stage.setHeight(100);
    stage.show();
}