Example usage for javafx.scene.layout AnchorPane AnchorPane

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

Introduction

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

Prototype

public AnchorPane() 

Source Link

Document

Creates an AnchorPane layout.

Usage

From source file:io.uploader.drive.auth.webbrowser.SimpleBrowserImpl.java

public SimpleBrowserImpl(Stage stage, String url) throws IOException {

    super();//from  w w w .j a va  2s  .c  om

    Preconditions.checkNotNull(stage);

    this.stage = stage;
    stage.setTitle("Drive Uploader - Authentication");
    UiUtils.setStageAppSize(stage);
    Scene scene = new Scene(new Group());

    AnchorPane root = new AnchorPane();

    final WebView browser = new WebView();
    webEngine = browser.getEngine();

    /*
    Menu settingsMenu = new Menu ("Settings") ;
    MenuItem proxy = new MenuItem ("Proxy") ;
    settingsMenu.getItems().add(proxy) ;
    MenuBar menuBar = new MenuBar () ;
    menuBar.getMenus().add(settingsMenu) ;
    proxy.setOnAction(new EventHandler<ActionEvent> () {
            
     @Override
     public void handle(ActionEvent event) {
    try {
       ProxySettingDialog dlg = new ProxySettingDialog (stage, Configuration.INSTANCE) ;
       dlg.showDialog();
    } catch (IOException e) {
       logger.error("Error occurred while opening the proxy setting dialog", e);
    }
     }});*/

    FXMLLoader mainMenuLoader = new FXMLLoader(getClass().getResource("/fxml/MainMenu.fxml"));
    VBox mainMenuBar = (VBox) mainMenuLoader.load();
    AnchorPane.setTopAnchor(mainMenuBar, 0.0);
    AnchorPane.setLeftAnchor(mainMenuBar, 0.0);
    AnchorPane.setRightAnchor(mainMenuBar, 0.0);
    MainMenuController mainMenuController = mainMenuLoader.<MainMenuController>getController();
    mainMenuController.setOwner(stage);
    mainMenuController.setConfiguration(Configuration.INSTANCE);
    mainMenuController.hideAccountMenu(true);

    ScrollPane scrollPane = new ScrollPane();
    scrollPane.setContent(browser);
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);

    if (StringUtils.isNotEmpty(url)) {
        goTo(url);
    }

    if (DriveUploader.isMacOsX()) {
        AnchorPane.setTopAnchor(scrollPane, 5.0);
    } else {
        AnchorPane.setTopAnchor(scrollPane, 35.0);
    }
    AnchorPane.setLeftAnchor(scrollPane, 5.0);
    AnchorPane.setRightAnchor(scrollPane, 5.0);
    AnchorPane.setBottomAnchor(scrollPane, 5.0);

    root.getChildren().add(mainMenuBar);
    root.getChildren().addAll(scrollPane);
    scene.setRoot(root);

    stage.setScene(scene);
}

From source file:Main.java

@Override
public void start(final Stage stage) throws Exception {
    fonts = Font.getFamilies().toArray(fonts);
    pagination = new Pagination(fonts.length / itemsPerPage(), 0);
    pagination.setPageFactory((Integer pageIndex) -> createPage(pageIndex));

    AnchorPane anchor = new AnchorPane();
    AnchorPane.setTopAnchor(pagination, 10.0);
    AnchorPane.setRightAnchor(pagination, 10.0);
    AnchorPane.setBottomAnchor(pagination, 10.0);
    AnchorPane.setLeftAnchor(pagination, 10.0);
    anchor.getChildren().addAll(pagination);
    Scene scene = new Scene(anchor, 400, 450);
    stage.setScene(scene);/*from   w ww . j ava2s .c  om*/
    stage.show();
}

From source file:Main.java

@Override
public void start(final Stage stage) throws Exception {
    pagination = new Pagination(28, 0);
    pagination.setPageFactory((Integer pageIndex) -> {
        if (pageIndex >= textPages.length) {
            return null;
        } else {//from w  w  w. j a  va  2  s.c  o  m
            return createPage(pageIndex);
        }
    });

    AnchorPane anchor = new AnchorPane();
    AnchorPane.setTopAnchor(pagination, 10.0);
    AnchorPane.setRightAnchor(pagination, 10.0);
    AnchorPane.setBottomAnchor(pagination, 10.0);
    AnchorPane.setLeftAnchor(pagination, 10.0);
    anchor.getChildren().addAll(pagination);
    Scene scene = new Scene(anchor, 400, 250);
    stage.setScene(scene);
    stage.setTitle("PaginationSample");
    stage.show();
}

From source file:de.micromata.mgc.javafx.launcher.gui.AbstractConfigDialog.java

private Tab createTab(LocalSettingsConfigModel configModel,
        Pair<Pane, ? extends AbstractConfigTabController<?>> wc) {
    AbstractConfigTabController<?> contrl = wc.getSecond();
    contrl.setConfigDialog(this);

    Pane tabPane = wc.getFirst();//from  w  w  w  . ja va 2 s.  co  m

    contrl.setTabPane(tabPane);
    Tab tabB = new Tab();

    AnchorPane tabContentPane = new AnchorPane();
    tabContentPane.setMaxHeight(Integer.MAX_VALUE);
    //    tabContentPane.setPrefHeight(500);
    FeedbackPanel feedback = new FeedbackPanel();

    feedback.setPrefHeight(100);
    feedback.setMinHeight(100);
    FXEvents.get().addEventHandler(this, feedback, FeedbackPanelEvents.CLEAR, event -> {
        feedback.clearMessages();
    });
    contrl.setFeedback(feedback);
    tabContentPane.getChildren().add(tabPane);
    tabContentPane.getChildren().add(feedback);
    AnchorPane.setTopAnchor(tabPane, 2.0);
    AnchorPane.setRightAnchor(tabPane, 0.0);
    AnchorPane.setLeftAnchor(tabPane, 0.0);
    AnchorPane.setBottomAnchor(tabPane, 70.0);
    AnchorPane.setBottomAnchor(feedback, 0.0);

    tabB.setContent(tabContentPane);
    AnchorPane.setTopAnchor(tabContentPane, 0.0);
    AnchorPane.setRightAnchor(tabContentPane, 0.0);
    AnchorPane.setLeftAnchor(tabContentPane, 0.0);
    AnchorPane.setBottomAnchor(tabContentPane, 0.0);

    Node scrollPane = tabPane.getChildren().get(0);
    AnchorPane.setTopAnchor(scrollPane, 0.0);
    AnchorPane.setRightAnchor(scrollPane, 0.0);
    AnchorPane.setLeftAnchor(scrollPane, 0.0);
    AnchorPane.setBottomAnchor(scrollPane, 0.0);

    configurationTabs.getTabs().add(tabB);
    tabController.add(contrl);
    contrl.setTab(tabB);
    ((ModelController) contrl).setModel(configModel);
    contrl.initializeWithModel();
    contrl.addToolTips();
    tabB.setText(contrl.getTabTitle());
    contrl.registerValMessageReceivers();

    return tabB;
}

From source file:ijfx.ui.canvas.FxCanvasTester.java

@Override
public void start(Stage primaryStage) {

    final SCIFIO scifio = new SCIFIO();
    MenuBar menuBar = new MenuBar();
    InputControl parameterInput = null;//from ww  w  .ja va 2 s  .  c  o m
    try {
        System.setProperty("imagej.legacy.sync", "true");
        //reader.getContext().inject(this);
        ImageJ imagej = new ImageJ();
        context = imagej.getContext();
        CommandInfo command = imagej.command().getCommand(GaussianBlur.class);

        CommandModuleItem input = command.getInput("sigma");
        Class<?> type = input.getType();
        if (type == double.class) {
            type = Double.class;
        }

        context.inject(this);

        GaussianBlur module = new GaussianBlur();

        imagej.ui().showUI();

        //reader = scifio.initializer().initializeReader("./stack.tif");
        commandService.run(OpenFile.class, true, new HashMap<String, Object>());

        menuBar = new MenuBar();
        menuService.createMenus(new FxMenuCreator(), menuBar);
        ObjectMapper mapper = new ObjectMapper();
        SimpleModule simpleModule = new SimpleModule("ModuleSerializer");
        // simpleModule.addSerializer(ModuleItem<?>.class,new ModuleItemSerializer());
        simpleModule.addSerializer(ModuleInfo.class, new ModuleSerializer());
        simpleModule.addSerializer(ModuleItem.class, new ModuleItemSerializer());
        mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
        mapper.enable(SerializationFeature.INDENT_OUTPUT);
        mapper.registerModule(simpleModule);

        mapper.writeValue(new File("modules.json"), moduleService.getModules());

    } catch (Exception ex) {
        ImageJFX.getLogger();
    }

    //imageView.fitImageToScreen();
    Button reset = new Button("Reset");

    reset.setOnAction(event -> update());

    BorderPane pane = new BorderPane();

    Button test = new Button("Test");

    AnchorPane root = new AnchorPane();
    root.getChildren().add(pane);
    root.getStylesheets().add(ArcMenu.class.getResource("arc-default.css").toExternalForm());
    root.getStylesheets().add(ImageJFX.class.getResource(("flatterfx.css")).toExternalForm());
    AnchorPane.setTopAnchor(pane, 0.0);
    AnchorPane.setBottomAnchor(pane, 0.0);
    AnchorPane.setLeftAnchor(pane, 0.0);
    AnchorPane.setRightAnchor(pane, 0.0);
    pane.setTop(menuBar);

    HBox vbox = new HBox();
    vbox.getChildren().addAll(reset, test, parameterInput);
    vbox.setSpacing(10);
    vbox.setPadding(new Insets(10, 10, 10, 10));
    // update();
    pane.setCenter(ImageWindowContainer.getInstance());
    // pane.setPrefSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
    pane.setBottom(vbox);

    Scene scene = new Scene(root, 600, 600);

    test.setOnAction(event -> {

        test();
    });

    primaryStage.setTitle("ImageCanvasTest");
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:com.jf.javafx.Application.java

/**
 * Load a node and its controller.//  ww w .  j  a  v a 2  s .c  o  m
 * 
 * @param path
 * @return the node
 */
public Pair<Node, ?> createNode(String path) {
    final Application app = this;
    File fxml = getTemplateFile(path + ".fxml");
    Node node;
    Object controller = null;
    try {
        ResourceBundle bundle;
        try {
            bundle = getResourceBundle("controllers/" + path);
        } catch (Exception ex) {
            bundle = null;
        }

        FXMLLoader loader = new FXMLLoader(fxml.toURL(), bundle, new JavaFXBuilderFactory(),
                (Class<?> param) -> {
                    try {
                        Class cls = Controller.class;

                        if (cls.isAssignableFrom(param)) {
                            try {
                                return param.getConstructor(Application.class).newInstance(app);
                            } catch (Exception ex) {
                                Logger.getLogger(Application.class.getName()).log(Level.SEVERE, null, ex);
                                return param.newInstance();
                            }
                        } else {
                            return param.newInstance();
                        }
                    } catch (IllegalAccessException | IllegalArgumentException | InstantiationException
                            | SecurityException ex) {
                        MsgBox.showException(ex);
                        return null;
                    }
                });
        node = loader.load();
        controller = loader.getController();
    } catch (IOException ex) {
        MsgBox.showException(ex, "Error while navigate to path: " + path);

        // customize error screen
        AnchorPane p = new AnchorPane();

        //            StringWriter sw = new StringWriter();
        //            ex.printStackTrace(new PrintWriter(sw));
        //            p.getChildren().add(new Label(sw.toString()));

        node = p;
    }

    return new Pair(node, controller);
}

From source file:Main.java

private AnchorPane addAnchorPane(GridPane grid) {

    AnchorPane anchorpane = new AnchorPane();

    Button buttonSave = new Button("Save");
    Button buttonCancel = new Button("Cancel");

    HBox hb = new HBox();
    hb.setPadding(new Insets(0, 10, 10, 10));
    hb.setSpacing(10);/*from  w  w w .  j ava 2 s.  c om*/
    hb.getChildren().addAll(buttonSave, buttonCancel);

    anchorpane.getChildren().addAll(grid, hb);
    // Anchor buttons to bottom right, anchor grid to top
    AnchorPane.setBottomAnchor(hb, 8.0);
    AnchorPane.setRightAnchor(hb, 5.0);
    AnchorPane.setTopAnchor(grid, 10.0);

    return anchorpane;
}

From source file:com.vladsch.idea.multimarkdown.editor.MultiMarkdownFxPreviewEditor.java

/**
 * Build a new instance of {@link MultiMarkdownFxPreviewEditor}.
 *
 * @param project the {@link Project} containing the document
 * @param doc     the {@link Document} previewed in this editor.
 *///from  w  w w .  j ava  2  s  .c  o  m
public MultiMarkdownFxPreviewEditor(@NotNull final Project project, @NotNull Document doc, boolean isRawHtml) {
    this.isRawHtml = isRawHtml;
    this.document = doc;
    this.project = project;
    this.isWikiDocument = isWikiDocument(document);
    containingFile = FileDocumentManager.getInstance().getFile(document);
    resolver = containingFile == null ? null : new GitHubLinkResolver(containingFile, project);

    // Listen to the document modifications.
    this.document.addDocumentListener(new DocumentAdapter() {
        @Override
        public void documentChanged(DocumentEvent e) {
            delayedHtmlPreviewUpdate(false);
        }
    });

    // Listen to settings changes
    MultiMarkdownGlobalSettings.getInstance()
            .addListener(globalSettingsListener = new MultiMarkdownGlobalSettingsListener() {
                public void handleSettingsChanged(@NotNull final MultiMarkdownGlobalSettings newSettings) {
                    if (project.isDisposed())
                        return;
                    processor = null;
                    updateEditorTabIsVisible();
                    updateLinkRenderer();
                    delayedHtmlPreviewUpdate(true);
                    checkNotifyUser();
                }
            });

    MultiMarkdownProjectComponent projectComponent = MultiMarkdownPlugin.getProjectComponent(project);
    if (projectComponent != null) {
        projectComponent.addListener(projectFileListener = new ReferenceChangeListener() {
            @Override
            public void referenceChanged(@Nullable String name) {
                if (project.isDisposed())
                    return;
                delayedHtmlPreviewUpdate(false);
            }
        });
    }

    project.getMessageBus().connect(this).subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() {
        @Override
        public void enteredDumbMode() {
        }

        @Override
        public void exitDumbMode() {
            // need to re-evaluate class link accessibility
            if (project.isDisposed())
                return;
            delayedHtmlPreviewUpdate(false);
        }
    });

    updateLinkRenderer();

    if (isRawHtml) {
        jEditorPane = null;
        jfxPanel = null;
        webView = null;
        webEngine = null;
        Language language = Language.findLanguageByID("HTML");
        FileType fileType = language != null ? language.getAssociatedFileType() : null;
        Document myDocument = EditorFactory.getInstance().createDocument("");
        myTextViewer = (EditorImpl) EditorFactory.getInstance().createViewer(myDocument, project);
        if (fileType != null)
            myTextViewer.setHighlighter(
                    EditorHighlighterFactory.getInstance().createEditorHighlighter(project, fileType));
    } else {
        // Setup the editor pane for rendering HTML.
        myTextViewer = null;
        jEditorPane = new JPanel(new BorderLayout(), false);
        jfxPanel = new JFXPanel(); // initializing javafx
        jEditorPane.add(jfxPanel, BorderLayout.CENTER);
        Platform.setImplicitExit(false);

        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                if (project.isDisposed())
                    return;

                webView = new WebView();
                webEngine = webView.getEngine();

                anchorPane = new AnchorPane();
                AnchorPane.setTopAnchor(webView, 0.0);
                AnchorPane.setLeftAnchor(webView, 0.0);
                AnchorPane.setBottomAnchor(webView, 0.0);
                AnchorPane.setRightAnchor(webView, 0.0);
                anchorPane.getChildren().add(webView);
                jfxPanel.setScene(new Scene(anchorPane));

                webEngine.setCreatePopupHandler(new Callback<PopupFeatures, WebEngine>() {
                    @Override
                    public WebEngine call(PopupFeatures config) {
                        // return a web engine for the new browser window or null to block popups
                        return null;
                    }
                });

                addStateChangeListener();
            }
        });
    }

    checkNotifyUser();
}

From source file:editeurpanovisu.EquiCubeDialogController.java

/**
 *
 * @param strTypeTransf/*from   w  w w.  ja v a 2s. c  o m*/
 * @throws Exception Exceptions
 */
public void afficheFenetre(String strTypeTransf) throws Exception {
    lvListeFichier.getItems().clear();
    stTransformations = new Stage(StageStyle.UTILITY);
    apTransformations = new AnchorPane();
    stTransformations.initModality(Modality.APPLICATION_MODAL);
    stTransformations.setResizable(true);
    apTransformations.setStyle("-fx-background-color : #ff0000;");

    VBox vbFenetre = new VBox();
    HBox hbChoix = new HBox();
    Pane paneChoixFichier = new Pane();
    btnAjouteFichiers = new Button("Ajouter des Fichiers");
    paneChoixTypeFichier = new Pane();
    Label lblType = new Label("Type des Fichiers de sortie");
    rbJpeg = new RadioButton("JPEG (.jpg)");
    rbBmp = new RadioButton("BMP (.bmp)");
    rbTiff = new RadioButton("TIFF (.tif)");
    cbSharpen = new CheckBox("Masque de nettet");
    cbSharpen.setSelected(EditeurPanovisu.isbNetteteTransf());
    slSharpen = new Slider(0, 2, EditeurPanovisu.getNiveauNetteteTransf());
    lblSharpen = new Label();
    double lbl = (Math.round(EditeurPanovisu.getNiveauNetteteTransf() * 20.d) / 20.d);
    lblSharpen.setText(lbl + "");
    slSharpen.setDisable(!EditeurPanovisu.isbNetteteTransf());
    lblSharpen.setDisable(!EditeurPanovisu.isbNetteteTransf());
    Pane paneboutons = new Pane();
    btnAnnuler = new Button("Fermer la fentre");
    btnValider = new Button("Lancer le traitement");

    strTypeTransformation = strTypeTransf;
    Image imgTransf;
    if (strTypeTransf.equals(EquiCubeDialogController.EQUI2CUBE)) {
        stTransformations.setTitle("Transformation d'quirectangulaire en faces de cube");
        imgTransf = new Image(
                "file:" + EditeurPanovisu.getStrRepertAppli() + File.separator + "images/equi2cube.png");
    } else {
        stTransformations.setTitle("Transformation de faces de cube en quirectangulaire");
        imgTransf = new Image(
                "file:" + EditeurPanovisu.getStrRepertAppli() + File.separator + "images/cube2equi.png");
    }
    ImageView ivTypeTransfert = new ImageView(imgTransf);
    ivTypeTransfert.setLayoutX(35);
    ivTypeTransfert.setLayoutY(280);
    paneChoixTypeFichier.getChildren().add(ivTypeTransfert);
    apTransformations.setPrefHeight(EditeurPanovisu.getHauteurE2C());
    apTransformations.setPrefWidth(EditeurPanovisu.getLargeurE2C());

    paneChoixFichier.setPrefHeight(350);
    paneChoixFichier.setPrefWidth(410);
    paneChoixFichier.setStyle("-fx-background-color: #d0d0d0; -fx-border-color: #bbb;");
    paneChoixTypeFichier.setPrefHeight(350);
    paneChoixTypeFichier.setPrefWidth(180);
    paneChoixTypeFichier.setStyle("-fx-background-color: #d0d0d0; -fx-border-color: #bbb;");
    hbChoix.getChildren().addAll(paneChoixFichier, paneChoixTypeFichier);
    vbFenetre.setPrefHeight(400);
    vbFenetre.setPrefWidth(600);
    apTransformations.getChildren().add(vbFenetre);
    hbChoix.setPrefHeight(350);
    hbChoix.setPrefWidth(600);
    hbChoix.setStyle("-fx-background-color: #d0d0d0;");
    paneboutons.setPrefHeight(50);
    paneboutons.setPrefWidth(600);
    paneboutons.setStyle("-fx-background-color: #d0d0d0;");
    vbFenetre.setStyle("-fx-background-color: #d0d0d0;");
    btnAnnuler.setLayoutX(296);
    btnAnnuler.setLayoutY(10);
    btnValider.setLayoutX(433);
    btnValider.setLayoutY(10);
    lvListeFichier.setPrefHeight(290);
    lvListeFichier.setPrefWidth(380);
    lvListeFichier.setEditable(true);
    lvListeFichier.setLayoutX(14);
    lvListeFichier.setLayoutY(14);
    btnAjouteFichiers.setLayoutX(259);
    btnAjouteFichiers.setLayoutY(319);
    paneChoixFichier.getChildren().addAll(lvListeFichier, btnAjouteFichiers);
    if (strTypeTransf.equals(EquiCubeDialogController.EQUI2CUBE)) {
        lblDragDropE2C = new Label(rbLocalisation.getString("transformation.dragDropE2C"));
    } else {
        lblDragDropE2C = new Label(rbLocalisation.getString("transformation.dragDropC2E"));
    }
    lblDragDropE2C.setMinHeight(lvListeFichier.getPrefHeight());
    lblDragDropE2C.setMaxHeight(lvListeFichier.getPrefHeight());
    lblDragDropE2C.setMinWidth(lvListeFichier.getPrefWidth());
    lblDragDropE2C.setMaxWidth(lvListeFichier.getPrefWidth());
    lblDragDropE2C.setLayoutX(14);
    lblDragDropE2C.setLayoutY(14);
    lblDragDropE2C.setAlignment(Pos.CENTER);
    lblDragDropE2C.setTextFill(Color.web("#c9c7c7"));
    lblDragDropE2C.setTextAlignment(TextAlignment.CENTER);
    lblDragDropE2C.setWrapText(true);
    lblDragDropE2C.setStyle("-fx-font-size : 24px");
    lblDragDropE2C.setStyle("-fx-background-color : rgba(128,128,128,0.1)");
    paneChoixFichier.getChildren().add(lblDragDropE2C);

    lblType.setLayoutX(14);
    lblType.setLayoutY(14);
    rbBmp.setLayoutX(43);
    rbBmp.setLayoutY(43);
    rbBmp.setUserData("bmp");
    if (EditeurPanovisu.getStrTypeFichierTransf().equals("bmp")) {
        rbBmp.setSelected(true);
    }
    rbBmp.setToggleGroup(tgTypeFichier);
    rbJpeg.setLayoutX(43);
    rbJpeg.setLayoutY(71);
    rbJpeg.setUserData("jpg");
    if (EditeurPanovisu.getStrTypeFichierTransf().equals("jpg")) {
        rbJpeg.setSelected(true);
    }
    rbJpeg.setToggleGroup(tgTypeFichier);
    if (EditeurPanovisu.getStrTypeFichierTransf().equals("tif")) {
        rbTiff.setSelected(true);
    }
    rbTiff.setLayoutX(43);
    rbTiff.setLayoutY(99);
    rbTiff.setToggleGroup(tgTypeFichier);
    rbTiff.setUserData("tif");
    tgTypeFichier.selectedToggleProperty().addListener((ov, old_toggle, new_toggle) -> {
        EditeurPanovisu.setStrTypeFichierTransf(tgTypeFichier.getSelectedToggle().getUserData().toString());
    });
    cbSharpen.setLayoutX(43);
    cbSharpen.setLayoutY(127);
    cbSharpen.selectedProperty().addListener((ov, old_val, new_val) -> {
        slSharpen.setDisable(!new_val);
        lblSharpen.setDisable(!new_val);
        EditeurPanovisu.setbNetteteTransf(new_val);
    });

    slSharpen.setShowTickMarks(true);
    slSharpen.setShowTickLabels(true);
    slSharpen.setMajorTickUnit(0.5f);
    slSharpen.setMinorTickCount(4);
    slSharpen.setBlockIncrement(0.05f);
    slSharpen.setSnapToTicks(true);
    slSharpen.setLayoutX(23);
    slSharpen.setLayoutY(157);
    slSharpen.setTooltip(new Tooltip("Choisissez le niveau d'accentuation de l'image"));
    slSharpen.valueProperty().addListener((observableValue, oldValue, newValue) -> {
        if (newValue == null) {
            lblSharpen.setText("");
            return;
        }
        DecimalFormat dfArrondi = new DecimalFormat();
        dfArrondi.setMaximumFractionDigits(2); //arrondi  2 chiffres apres la virgules
        dfArrondi.setMinimumFractionDigits(2);
        dfArrondi.setDecimalSeparatorAlwaysShown(true);

        lblSharpen.setText(dfArrondi.format(Math.round(newValue.floatValue() * 20.f) / 20.f) + "");
        EditeurPanovisu.setNiveauNetteteTransf(newValue.doubleValue());
    });

    slSharpen.setPrefWidth(120);
    lblSharpen.setLayoutX(150);
    lblSharpen.setLayoutY(150);
    lblSharpen.setMinWidth(30);
    lblSharpen.setMaxWidth(30);
    lblSharpen.setTextAlignment(TextAlignment.RIGHT);

    paneChoixTypeFichier.getChildren().addAll(lblType, rbBmp, rbJpeg, rbTiff, cbSharpen, slSharpen, lblSharpen);
    pbBarreImage.setLayoutX(40);
    pbBarreImage.setLayoutY(190);
    pbBarreImage.setStyle("-fx-accent : #0000bb");
    pbBarreImage.setVisible(false);
    paneChoixTypeFichier.getChildren().add(pbBarreImage);
    pbBarreAvancement = new ProgressBar();
    pbBarreAvancement.setLayoutX(40);
    pbBarreAvancement.setLayoutY(220);
    pbBarreImage.setStyle("-fx-accent : #00bb00");
    paneChoixTypeFichier.getChildren().add(pbBarreAvancement);
    pbBarreAvancement.setVisible(false);

    paneboutons.getChildren().addAll(btnAnnuler, btnValider);
    vbFenetre.getChildren().addAll(hbChoix, paneboutons);
    Scene scnTransformations = new Scene(apTransformations);
    stTransformations.setScene(scnTransformations);
    stTransformations.show();

    btnAnnuler.setOnAction((e) -> {
        annulerE2C();
    });
    btnValider.setOnAction((e) -> {
        if (!bTraitementEffectue) {
            validerE2C();
        }
    });
    btnAjouteFichiers.setOnAction((e) -> {
        lblTermine.setText("");
        fileLstFichier = choixFichiers();
        if (fileLstFichier != null) {
            if (bTraitementEffectue) {
                lvListeFichier.getItems().clear();
                bTraitementEffectue = false;
            }
            for (File fileLstFichier1 : fileLstFichier) {
                String strNomFich = fileLstFichier1.getAbsolutePath();
                lvListeFichier.getItems().add(strNomFich);
            }
        }
    });
    lvListeFichier.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {
        @Override
        public ListCell<String> call(ListView<String> list) {
            return new ListeTransformationCouleur();
        }
    });
    apTransformations.setOnDragOver((event) -> {
        Dragboard dbFichiersTransformation = event.getDragboard();
        if (dbFichiersTransformation.hasFiles()) {
            event.acceptTransferModes(TransferMode.ANY);
        } else {
            event.consume();
        }
    });
    stTransformations.widthProperty().addListener((arg0, arg1, arg2) -> {
        EditeurPanovisu.setLargeurE2C(stTransformations.getWidth());
        apTransformations.setPrefWidth(stTransformations.getWidth());
        vbFenetre.setPrefWidth(stTransformations.getWidth());
        btnAnnuler.setLayoutX(stTransformations.getWidth() - 314);
        btnValider.setLayoutX(stTransformations.getWidth() - 157);
        paneChoixFichier.setPrefWidth(stTransformations.getWidth() - 200);
        lvListeFichier.setPrefWidth(stTransformations.getWidth() - 240);
        lblDragDropE2C.setMinWidth(lvListeFichier.getPrefWidth());
        lblDragDropE2C.setMaxWidth(lvListeFichier.getPrefWidth());

        btnAjouteFichiers.setLayoutX(stTransformations.getWidth() - 341);
    });

    stTransformations.heightProperty().addListener((arg0, arg1, arg2) -> {
        EditeurPanovisu.setHauteurE2C(stTransformations.getHeight());
        apTransformations.setPrefHeight(stTransformations.getHeight());
        vbFenetre.setPrefHeight(stTransformations.getHeight());
        paneChoixFichier.setPrefHeight(stTransformations.getHeight() - 80);
        hbChoix.setPrefHeight(stTransformations.getHeight() - 80);
        lvListeFichier.setPrefHeight(stTransformations.getHeight() - 140);
        lblDragDropE2C.setMinHeight(lvListeFichier.getPrefHeight());
        lblDragDropE2C.setMaxHeight(lvListeFichier.getPrefHeight());
        btnAjouteFichiers.setLayoutY(stTransformations.getHeight() - 121);
    });
    stTransformations.setWidth(EditeurPanovisu.getLargeurE2C());
    stTransformations.setHeight(EditeurPanovisu.getHauteurE2C());
    apTransformations.setOnDragDropped((event) -> {
        Dragboard dbFichiersTransformation = event.getDragboard();
        boolean bSucces = false;
        File[] fileLstFich;
        fileLstFich = null;
        if (dbFichiersTransformation.hasFiles()) {
            lblTermine.setText("");
            bSucces = true;
            String[] stringFichiersPath = new String[200];
            int i = 0;
            for (File file1 : dbFichiersTransformation.getFiles()) {
                stringFichiersPath[i] = file1.getAbsolutePath();
                i++;
            }
            int iNb = i;
            i = 0;
            boolean bAttention = false;
            File[] fileLstFich1 = new File[stringFichiersPath.length];
            for (int j = 0; j < iNb; j++) {

                String strNomfich = stringFichiersPath[j];
                File fileTransf = new File(strNomfich);
                String strExtension = strNomfich.substring(strNomfich.lastIndexOf(".") + 1, strNomfich.length())
                        .toLowerCase();
                if (strExtension.equals("bmp") || strExtension.equals("jpg") || strExtension.equals("tif")) {
                    if (i == 0) {
                        strRepertFichier = fileTransf.getParent();
                    }
                    Image img = null;
                    if (strExtension != "tif") {
                        img = new Image("file:" + fileTransf.getAbsolutePath());
                    } else {
                        try {
                            img = ReadWriteImage.readTiff(strNomfich);
                        } catch (ImageReadException ex) {
                            Logger.getLogger(EquiCubeDialogController.class.getName()).log(Level.SEVERE, null,
                                    ex);
                        } catch (IOException ex) {
                            Logger.getLogger(EquiCubeDialogController.class.getName()).log(Level.SEVERE, null,
                                    ex);
                        }
                    }
                    if (strTypeTransformation.equals(EquiCubeDialogController.EQUI2CUBE)) {
                        if (img.getWidth() == 2 * img.getHeight()) {
                            fileLstFich1[i] = fileTransf;
                            i++;
                        } else {
                            bAttention = true;
                        }
                    } else {
                        if (img.getWidth() == img.getHeight()) {
                            String strNom = fileTransf.getAbsolutePath().substring(0,
                                    fileTransf.getAbsolutePath().length() - 6);
                            boolean bTrouve = false;
                            for (int ik = 0; ik < i; ik++) {
                                String strNom1 = fileLstFich1[ik].getAbsolutePath().substring(0,
                                        fileTransf.getAbsolutePath().length() - 6);
                                if (strNom.equals(strNom1)) {
                                    bTrouve = true;
                                }
                            }
                            if (!bTrouve) {
                                fileLstFich1[i] = fileTransf;
                                i++;
                            }
                        } else {
                            bAttention = true;
                        }

                    }
                }
            }
            if (bAttention) {
                Alert alert = new Alert(AlertType.ERROR);
                alert.setTitle(rbLocalisation.getString("transformation.traiteImages"));
                alert.setHeaderText(null);
                alert.setContentText(rbLocalisation.getString("transformation.traiteImagesType"));
                alert.showAndWait();
            }
            fileLstFichier = new File[i];
            System.arraycopy(fileLstFich1, 0, fileLstFichier, 0, i);
        }
        if (fileLstFichier != null) {
            if (bTraitementEffectue) {
                lvListeFichier.getItems().clear();
                bTraitementEffectue = false;
            }
            for (File lstFichier1 : fileLstFichier) {
                String nomFich = lstFichier1.getAbsolutePath();
                lvListeFichier.getItems().add(nomFich);
            }
        }
        lblDragDropE2C.setVisible(false);
        event.setDropCompleted(bSucces);
        event.consume();
    });

}

From source file:editeurpanovisu.EditeurPanovisu.java

private AnchorPane afficherListePanosVignettes(int numHS) {

    AnchorPane aplistePano = new AnchorPane();
    aplistePano.setOpacity(1);/*w  w  w . j  av  a  2  s  .c om*/
    Pane fond = new Pane();
    fond.setStyle("-fx-background-color : #bbb;");
    fond.setPrefWidth(540);
    fond.setPrefHeight(((nombrePanoramiques - 2) / 4 + 1) * 65 + 10);
    fond.setMinWidth(540);
    fond.setMinHeight(70);
    aplistePano.getChildren().add(fond);
    aplistePano.setStyle("-fx-backgroung-color : #bbb;");
    int j = 0;
    ImageView[] IVPano;
    IVPano = new ImageView[nombrePanoramiques];
    double xPos;
    double yPos;
    int row = 0;
    for (int i = 0; i < nombrePanoramiques; i++) {
        int numeroPano = i;
        IVPano[j] = new ImageView(panoramiquesProjet[i].getVignettePanoramique());
        IVPano[j].setFitWidth(120);
        IVPano[j].setFitHeight(60);
        IVPano[j].setSmooth(true);
        String nomPano = panoramiquesProjet[i].getNomFichier();
        int col = j % 4;
        row = j / 4;
        xPos = col * 130 + 25;
        yPos = row * 65 + 5;
        IVPano[j].setLayoutX(xPos);
        IVPano[j].setLayoutY(yPos);
        IVPano[j].setCursor(Cursor.HAND);
        IVPano[j].setStyle("-fx-background-color : #ccc;");
        Tooltip t = new Tooltip(
                nomPano.substring(nomPano.lastIndexOf(File.separator) + 1, nomPano.lastIndexOf(".")));
        t.setStyle(tooltipStyle);
        Tooltip.install(IVPano[j], t);
        IVPano[j].setOnMouseClicked((MouseEvent me) -> {
            pano.setCursor(Cursor.CROSSHAIR);
            pano.setOnMouseClicked((MouseEvent me1) -> {
                gereSourisPanoramique(me1);
            });
            panoListeVignette = nomPano;
            if (panoramiquesProjet[numeroPano].getTitrePanoramique() != null) {
                String texteHS = panoramiquesProjet[numeroPano].getTitrePanoramique();
                TextArea txtHS = (TextArea) outils.lookup("#txtHS" + numHS);
                txtHS.setText(texteHS);
            }
            panoramiquesProjet[panoActuel].getHotspot(numHS).setNumeroPano(numeroPano);
            ComboBox cbx = (ComboBox) outils.lookup("#cbpano" + numHS);
            cbx.setValue(nomPano.substring(nomPano.lastIndexOf(File.separator) + 1, nomPano.lastIndexOf(".")));
            aplistePano.setVisible(false);
            me.consume();
        });
        aplistePano.getChildren().add(IVPano[j]);
        j++;

    }
    int taille = (row + 1) * 65 + 5;
    aplistePano.setPrefWidth(540);
    aplistePano.setPrefHeight(taille);
    aplistePano.setMinWidth(540);
    aplistePano.setMinHeight(taille);
    ImageView IVClose = new ImageView(
            new Image("file:" + repertAppli + File.separator + "images/ferme.png", 20, 20, true, true));
    IVClose.setLayoutX(2);
    IVClose.setLayoutY(5);
    IVClose.setCursor(Cursor.HAND);
    aplistePano.getChildren().add(IVClose);
    IVClose.setOnMouseClicked((MouseEvent me) -> {
        pano.setCursor(Cursor.CROSSHAIR);
        pano.setOnMouseClicked((MouseEvent me1) -> {
            gereSourisPanoramique(me1);
        });

        panoListeVignette = "";
        aplistePano.setVisible(false);
        me.consume();
    });
    aplistePano.setTranslateZ(2);
    return aplistePano;
}