Example usage for javafx.stage FileChooser getExtensionFilters

List of usage examples for javafx.stage FileChooser getExtensionFilters

Introduction

In this page you can find the example usage for javafx.stage FileChooser getExtensionFilters.

Prototype

public ObservableList<ExtensionFilter> getExtensionFilters() 

Source Link

Document

Gets the extension filters used in the displayed file dialog.

Usage

From source file:com.ggvaidya.scinames.dataset.BinomialChangesSceneController.java

private void exportToCSV(TableView tv, ActionEvent evt) {
    FileChooser chooser = new FileChooser();
    chooser.getExtensionFilters().setAll(new FileChooser.ExtensionFilter("CSV file", "*.csv"),
            new FileChooser.ExtensionFilter("Tab-delimited file", "*.txt"));
    File file = chooser.showSaveDialog(binomialChangesView.getStage());
    if (file != null) {
        CSVFormat format = CSVFormat.RFC4180;

        String outputFormat = chooser.getSelectedExtensionFilter().getDescription();
        if (outputFormat.equalsIgnoreCase("Tab-delimited file"))
            format = CSVFormat.TDF;/*from   ww  w.  j a  v a  2s .  com*/

        try {
            List<List<String>> dataAsTable = getDataAsTable(tv);
            fillCSVFormat(format, new FileWriter(file), dataAsTable);

            Alert window = new Alert(Alert.AlertType.CONFIRMATION,
                    "CSV file '" + file + "' saved with " + (dataAsTable.get(0).size() - 1) + " rows.");
            window.showAndWait();

        } catch (IOException e) {
            Alert window = new Alert(Alert.AlertType.ERROR, "Could not save CSV to '" + file + "': " + e);
            window.showAndWait();
        }
    }
}

From source file:dsfixgui.view.DSPWPane.java

private void initializeEventHandlers() {

    applySettingsButton.setOnAction(e -> {
        ui.applyDSPWConfig();/*from   w w  w  . java2s  .c om*/
    });

    restoreDefaultsButton.setOnAction(e -> {
        ContinueDialog cD = new ContinueDialog(300.0, 80.0, DIALOG_TITLE_RESET, DIALOG_MSG_RESTORE_SETTINGS,
                DIALOG_BUTTON_TEXTS[2], DIALOG_BUTTON_TEXTS[1]);
        if (cD.show()) {
            config.restoreDefaults();
            ui.refreshUI();
        }
    });

    versionBannerOn.setOnAction(e -> {
        config.ShowVersionBanner.replace(0, config.ShowVersionBanner.length(), TRUE_FALSE[0]);
    });

    versionBannerOff.setOnAction(e -> {
        config.ShowVersionBanner.replace(0, config.ShowVersionBanner.length(), TRUE_FALSE[1]);
    });

    overlayOn.setOnAction(e -> {
        config.ShowOverlay.replace(0, config.ShowOverlay.length(), TRUE_FALSE[0]);
    });

    overlayOff.setOnAction(e -> {
        config.ShowOverlay.replace(0, config.ShowOverlay.length(), TRUE_FALSE[1]);
    });

    invasionNotifOn.setOnAction(e -> {
        config.InvasionSoundNotification.replace(0, config.InvasionSoundNotification.length(), TRUE_FALSE[0]);
    });

    invasionNotifOff.setOnAction(e -> {
        config.InvasionSoundNotification.replace(0, config.InvasionSoundNotification.length(), TRUE_FALSE[1]);
    });

    cheaterNotifOn.setOnAction(e -> {
        config.CheaterSoundNotification.replace(0, config.CheaterSoundNotification.length(), TRUE_FALSE[0]);
    });

    cheaterNotifOff.setOnAction(e -> {
        config.CheaterSoundNotification.replace(0, config.CheaterSoundNotification.length(), TRUE_FALSE[1]);
    });

    blockArenaFreezeOn.setOnAction(e -> {
        config.BlockArenaFreeze.replace(0, config.BlockArenaFreeze.length(), TRUE_FALSE[0]);
    });

    blockArenaFreezeOff.setOnAction(e -> {
        config.BlockArenaFreeze.replace(0, config.BlockArenaFreeze.length(), TRUE_FALSE[1]);
    });

    nodeCountOn.setOnAction(e -> {
        config.ShowNodeDbCount.replace(0, config.ShowNodeDbCount.length(), TRUE_FALSE[0]);
    });

    nodeCountOff.setOnAction(e -> {
        config.ShowNodeDbCount.replace(0, config.ShowNodeDbCount.length(), TRUE_FALSE[1]);
    });

    increaseNodesOn.setOnAction(e -> {
        config.IncreaseNodeDbLimit.replace(0, config.IncreaseNodeDbLimit.length(), TRUE_FALSE[0]);
    });

    increaseNodesOff.setOnAction(e -> {
        config.IncreaseNodeDbLimit.replace(0, config.IncreaseNodeDbLimit.length(), TRUE_FALSE[1]);
    });

    dateOn.setOnAction(e -> {
        config.DisplayDate.replace(0, config.DisplayDate.length(), TRUE_FALSE[0]);
    });

    dateOff.setOnAction(e -> {
        config.DisplayDate.replace(0, config.DisplayDate.length(), TRUE_FALSE[1]);
    });

    timeOn.setOnAction(e -> {
        config.DisplayClock.replace(0, config.DisplayClock.length(), TRUE_FALSE[0]);
    });

    timeOff.setOnAction(e -> {
        config.DisplayClock.replace(0, config.DisplayClock.length(), TRUE_FALSE[1]);
    });

    updateOn.setOnAction(e -> {
        config.CheckForUpdates.replace(0, config.CheckForUpdates.length(), TRUE_FALSE[0]);
    });

    updateOff.setOnAction(e -> {
        config.CheckForUpdates.replace(0, config.CheckForUpdates.length(), TRUE_FALSE[1]);
    });

    textAlignmentLeft.setOnAction(e -> {
        config.TextAlignment.replace(0, config.TextAlignment.length(), DSPW_TEXT_ALIGNMENT_OPTIONS[0]);
    });

    textAlignmentCenter.setOnAction(e -> {
        config.TextAlignment.replace(0, config.TextAlignment.length(), DSPW_TEXT_ALIGNMENT_OPTIONS[1]);
    });

    textAlignmentRight.setOnAction(e -> {
        config.TextAlignment.replace(0, config.TextAlignment.length(), DSPW_TEXT_ALIGNMENT_OPTIONS[2]);
    });

    fontSizeField.textProperty().addListener(new ChangeListener<String>() {
        @Override
        public void changed(ObservableValue<? extends String> observable, String oldText, String newText) {
            try {
                if (!NumberUtils.isParsable(newText) || Integer.parseInt(newText) > 72
                        || Integer.parseInt(newText) < 15) {
                    fontSizeField.pseudoClassStateChanged(INVALID_INPUT, true);
                } else {
                    fontSizeField.pseudoClassStateChanged(INVALID_INPUT, false);
                    config.FontSize.replace(0, config.FontSize.length(), "" + Integer.parseInt(newText));
                }
            } catch (NumberFormatException nFE) {
                ui.printConsole(INPUT_TOO_LARGE);
                fontSizeField.setText("");
            }
        }
    });

    dllChainButton.setOnAction(e -> {
        FileChooser dllChooser = new FileChooser();
        dllChooser.setTitle(DIALOG_TITLE_DLL);
        if (ui.getDataFolder() != null) {
            dllChooser.setInitialDirectory(ui.getDataFolder());
        }
        ExtensionFilter dllFilter = new ExtensionFilter(DLL_EXT_FILTER[0], DLL_EXT_FILTER[1]);
        dllChooser.getExtensionFilters().add(dllFilter);

        File dll = dllChooser.showOpenDialog(ui.getStage());

        if (dll != null && ui.getDataFolder() != null) {
            File checkDLL = new File(ui.getDataFolder() + "\\" + dll.getName());
            if (!checkDLL.exists()) {
                AlertDialog aD = new AlertDialog(300.0, 80.0, DIALOG_TITLE_WRONG_FOLDER, DLL_MUST_BE_IN_DATA,
                        DIALOG_BUTTON_TEXTS[0]);
            } else {
                if (dll.getName().equals(DSM_FILES[0])) {
                    AlertDialog aD = new AlertDialog(300.0, 80.0, INVALID_DLL, CANT_CHAIN_DLL_WITH_DSM,
                            DIALOG_BUTTON_TEXTS[0]);
                } else if (dll.getName().equals(DSF_FILES[0])) {
                    AlertDialog aD = new AlertDialog(300.0, 80.0, INVALID_DLL, CANT_CHAIN_DLL_WITH_DSF,
                            DIALOG_BUTTON_TEXTS[0]);
                } else if (dll.getName().equals(DS_DEFAULT_DLLS[0]) || dll.getName().equals(DS_DEFAULT_DLLS[1])
                        || dll.getName().equals(DS_DEFAULT_DLLS[2])) {
                    AlertDialog aD = new AlertDialog(300.0, 80.0, INVALID_DLL, CANT_CHAIN_DLL_WITH_DEFAULT,
                            DIALOG_BUTTON_TEXTS[0]);
                } else if (dll.getName().equals(DSPW_FILES[1]) || dll.getName().equals(DSPW_FILES[4])
                        || dll.getName().equals(DSPW_FILES[5])) {
                    AlertDialog aD = new AlertDialog(300.0, 80.0, INVALID_DLL, CANT_CHAIN_DSPW_WITH_DSPW,
                            DIALOG_BUTTON_TEXTS[0]);
                } else {
                    config.d3d9dllWrapper.replace(0, config.d3d9dllWrapper.length(), dll.getName());
                    dllChainField.setText(dll.getName());
                    dllChainField.setStyle("-fx-text-fill: black;");
                    noChainButton.setDisable(false);
                }
            }
        }
    });

    noChainButton.setOnAction(e -> {
        dllChainField.setText(NONE);
        noChainButton.setDisable(true);
        dllChainField.setStyle("-fx-text-fill: gray;");
        config.d3d9dllWrapper.replace(0, config.d3d9dllWrapper.length(), NONE);
    });

    banPicker.setOnAction(e -> {
        config.key_BanPhantom.replace(0, config.key_BanPhantom.length(),
                keybindsHex.get(keybinds.indexOf(banPicker.getValue())));
    });

    ignorePicker.setOnAction(e -> {
        config.key_IgnorePhantom.replace(0, config.key_IgnorePhantom.length(),
                keybindsHex.get(keybinds.indexOf(ignorePicker.getValue())));
    });

    toggleOverlayPicker.setOnAction(e -> {
        config.key_HideOverlay.replace(0, config.key_HideOverlay.length(),
                keybindsHex.get(keybinds.indexOf(toggleOverlayPicker.getValue())));
    });

    aboutPicker.setOnAction(e -> {
        config.key_AboutDSPW.replace(0, config.key_AboutDSPW.length(),
                keybindsHex.get(keybinds.indexOf(aboutPicker.getValue())));
    });

}

From source file:org.beryx.viewreka.fxapp.Viewreka.java

public void openFile() {
    if (project != null) {
        ProjectSettings projectSettings = project.getProjectSettingsManager().getSettings();
        if (getOpenFiles(projectSettings).size() >= MAX_OPEN_FILES) {
            Dialogs.error("Open File error", "Too many open files.", "Please close some of your open files.",
                    null);/*from w w w . j  a va 2s  .c  om*/
            return;
        }
    }
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Open file");
    fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("All files", "*.*"),
            new FileChooser.ExtensionFilter("Viewreka files", "*.viewreka"),
            new FileChooser.ExtensionFilter("SQL files", "*.sql"),
            new FileChooser.ExtensionFilter("CSS files", "*.css"));
    GuiSettings guiSettings = guiSettingsManager.getSettings();
    fileChooser.setInitialDirectory(guiSettings.getMostRecentProjectDir());
    File file = fileChooser.showOpenDialog(getScene().getWindow());
    openFile(file);
}

From source file:com.github.drbookings.ui.controller.MainController.java

private void openFile() {
    if (logger.isDebugEnabled()) {
        logger.debug("Opening DrBookings xml");
    }//ww w . j  a  va  2 s .c o  m
    final FileChooser fileChooser = new FileChooser();
    final File file = SettingsManager.getInstance().getDataFile();
    fileChooser.setInitialDirectory(file.getParentFile());
    fileChooser.getExtensionFilters().addAll(
            new FileChooser.ExtensionFilter("Dr.BookingBean BookingBean Data", Arrays.asList("*.xml", "*.XML")),
            new FileChooser.ExtensionFilter("All Files", "*"));
    fileChooser.setTitle("Open Resource File");
    fileChooser.setInitialFileName(file.getName());
    final File file2 = fileChooser.showOpenDialog(node.getScene().getWindow());
    if (file2 != null) {
        readDataFile(file2);

    }
}

From source file:org.beryx.viewreka.fxapp.Viewreka.java

public void selectStylesheet() {
    if (project == null)
        return;/*from  w w w.j a  va  2 s.c o m*/

    ProjectSettings projectSettings = project.getProjectSettingsManager().getSettings();

    GuiSettings guiSettings = guiSettingsManager.getSettings();
    File initialCssDir = guiSettings.getMostRecentProjectDir();
    String chartStylesheet = projectSettings.getProperty(PROP_CHART_STYLESHEET, null, true);
    if (chartStylesheet != null) {
        try {
            URL cssUrl = new URI(chartStylesheet).toURL();
            if ("file".equals(cssUrl.getProtocol())) {
                File cssDir = new File(cssUrl.getFile()).getParentFile();
                if (cssDir != null && cssDir.isDirectory()) {
                    initialCssDir = cssDir;
                }
            }
        } catch (Exception e) {
            log.warn("Unable to retrieve directory of '" + chartStylesheet + "'", e);
        }
    }

    FileChooser cssChooser = new FileChooser();
    cssChooser.setTitle("Select stylesheet");
    cssChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("CSS files", "*.css"),
            new FileChooser.ExtensionFilter("All files", "*.*"));
    cssChooser.setInitialDirectory(initialCssDir);
    File cssFile = cssChooser.showOpenDialog(getStage());
    if (cssFile != null && cssFile.isFile()) {
        try {
            String newChartStylesheet = cssFile.toURI().normalize().toURL().toExternalForm();
            projectSettings.setProperty(PROP_CHART_STYLESHEET, newChartStylesheet);
        } catch (Exception e) {
            Dialogs.error("Stylesheet error", "Cannot set the stylesheet '" + cssFile + "'.", e);
        }
    }
    project.getProjectSettingsManager().saveSettings();
    refreshViews();
}

From source file:org.beryx.viewreka.fxapp.Viewreka.java

public void openProject(boolean loadLastProject, boolean doOnlyViewUpdates) {
    GuiSettings guiSettings = guiSettingsManager.getSettings();

    File initialProjectDir = guiSettings.getMostRecentProjectDir();
    File projectFile = null;//w ww . ja v a2s.c  o  m
    if (loadLastProject) {
        File initialProject = null;
        List<String> recentProjectPaths = guiSettings.getRecentProjectPaths();
        if (!recentProjectPaths.isEmpty() && (initialProjectDir != null) && initialProjectDir.isDirectory()) {
            try {
                initialProject = new File(recentProjectPaths.get(0));
                if (!initialProject.isFile()) {
                    initialProject = null;
                }
            } catch (Exception e) {
                log.debug("Error creating project file", e);
                initialProject = null;
            }
        }
        projectFile = initialProject;
    } else {
        FileChooser projectChooser = new FileChooser();
        projectChooser.setTitle("Open Viewreka Project");
        projectChooser.getExtensionFilters().addAll(
                new FileChooser.ExtensionFilter("Viewreka files", "*.viewreka"),
                new FileChooser.ExtensionFilter("All files", "*.*"));
        projectChooser.setInitialDirectory(initialProjectDir);
        projectFile = projectChooser.showOpenDialog(getStage());
    }

    if (projectFile != null) {
        openProject(projectFile, doOnlyViewUpdates);
    }
}

From source file:genrsa.GenRSAController.java

/**
 * Mtodo usado cuando se pulsa el boton de generarLog de NNC
 * @param event //from   w  w w.  ja v  a  2s . c  om
 */
public void generateNNC(ActionEvent event) {

    if (this.startLogNNC) {

        //todo se hace antes del thread porque si no nose podria manejar la ventana
        //para que se decidiera donde se guarda el archivo.
        FileChooser.ExtensionFilter extensionFilter = new FileChooser.ExtensionFilter("HTML files", "*.html");
        FileChooser fileChooser = new FileChooser();
        fileChooser.setInitialDirectory(new File(System.getProperty("user.dir")));
        fileChooser.getExtensionFilters().add(extensionFilter);
        fileChooser.setTitle("Seleccionar directorio donde guardar el log");
        fileChooser.setInitialFileName("LogNNC genRSA");
        File logNNCFile = fileChooser.showSaveDialog(labelPubKey.getScene().getWindow());

        Task CAstart = new Task() {
            @Override
            protected Object call() throws Exception {
                startLogNNC = false;
                progressNNC.setVisible(true);
                Platform.runLater(() -> {
                    disableOnProgress(true);
                    configureLogStop(true);
                });

                manageKey.saveLogNNC(progressNNC, RSA, logNNCFile);

                Platform.runLater(() -> {
                    disableOnProgress(false);
                    configureLogStop(false);
                });
                progressNNC.setVisible(false);
                startLogNNC = true;
                return null;
            }
        };

        new Thread(CAstart).start();

    } else {
        this.manageKey.setLogCancelled();
        this.startLogNNC = true;
    }
}

From source file:uk.bl.dpt.qa.gui.DissimilarGUIThread.java

@FXML
void openFile(ActionEvent event) {
    FileChooser chooser = new FileChooser();
    chooser.setTitle("Choose an input CSV file...");
    chooser.getExtensionFilters().add(new ExtensionFilter("CSV file with input pairs", "*.csv"));
    chooser.setInitialDirectory(new File("f:/eclipse-workspace/dissimilar/"));
    Window window = mainPane.getScene().getWindow();
    File inputFile = chooser.showOpenDialog(window);
    if (inputFile != null && inputFile.exists()) {
        internalOpenFile(inputFile);/* w w  w .j  a v  a 2  s.com*/
    }
}

From source file:uk.bl.dpt.qa.gui.DissimilarGUIThread.java

@FXML
void saveResults(ActionEvent event) {
    FileChooser chooser = new FileChooser();
    chooser.setTitle("Choose an output CSV file...");
    chooser.getExtensionFilters().add(new ExtensionFilter("CSV file", "*.csv"));
    Window window = mainPane.getScene().getWindow();
    File outputFile = chooser.showOpenDialog(window);
    if (outputFile != null) {
        //internalSaveFile(outputFile);//overwrite?
        gLogger.trace("FIXME: file saving");
    } else {//w  w w .j  a  v  a  2 s. c  o m
        internalSaveFile(outputFile);
    }
}

From source file:com.chart.SwingChart.java

/**
 * /*from  ww  w .j a  v a 2s .com*/
 * @param name Chart name
 * @param parent Skeleton parent
 * @param axes Configuration of axes
 * @param abcissaName Abcissa name
 */
public SwingChart(String name, final Skeleton parent, List<AxisChart> axes, String abcissaName) {
    this.skeleton = parent;
    this.axes = axes;
    this.name = name;

    this.abcissaFormat = NumberFormat.getInstance(Locale.getDefault());
    this.ordinateFormat = NumberFormat.getInstance(Locale.getDefault());

    plot = new XYPlot();
    plot.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strChartBackgroundColor)));
    plot.setDomainGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor)));
    plot.setRangeGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor)));
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));

    abcissaAxis = new NumberAxis(abcissaName);
    ((NumberAxis) abcissaAxis).setAutoRangeIncludesZero(false);
    abcissaAxis.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    abcissaAxis.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
    abcissaAxis.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
    abcissaAxis.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
    abcissaAxis.setAutoRange(true);
    abcissaAxis.setLowerMargin(0.0);
    abcissaAxis.setUpperMargin(0.0);
    abcissaAxis.setTickLabelsVisible(true);
    abcissaAxis.setLabelFont(abcissaAxis.getLabelFont().deriveFont(fontSize));
    abcissaAxis.setTickLabelFont(abcissaAxis.getLabelFont().deriveFont(fontSize));

    plot.setDomainAxis(abcissaAxis);

    for (int i = 0; i < axes.size(); i++) {
        AxisChart categoria = axes.get(i);
        addAxis(categoria.getName());

        for (int j = 0; j < categoria.configSerieList.size(); j++) {
            SimpleSeriesConfiguration cs = categoria.configSerieList.get(j);
            addSeries(categoria.getName(), cs);
        }
    }
    chart = new JFreeChart("", new Font("SansSerif", Font.BOLD, 16), plot, false);

    chart.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor)));

    chartPanel = new ChartPanel(chart);
    chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4),
            BorderFactory.createLineBorder(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor)))));

    chartPanel.getInputMap().put(KeyStroke.getKeyStroke("ESCAPE"), "escape");
    chartPanel.getActionMap().put("escape", new AbstractAction() {

        @Override
        public void actionPerformed(java.awt.event.ActionEvent e) {
            for (int i = 0; i < plot.getDatasetCount(); i++) {
                XYDataset test = plot.getDataset(i);
                XYItemRenderer r = plot.getRenderer(i);
                r.removeAnnotations();
            }
        }
    });

    chartPanel.addChartMouseListener(cml = new ChartMouseListener() {
        @Override
        public void chartMouseClicked(ChartMouseEvent event) {
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent event) {
            try {
                XYItemEntity xyitem = (XYItemEntity) event.getEntity(); // get clicked entity
                XYDataset dataset = (XYDataset) xyitem.getDataset(); // get data set    
                double x = dataset.getXValue(xyitem.getSeriesIndex(), xyitem.getItem());
                double y = dataset.getYValue(xyitem.getSeriesIndex(), xyitem.getItem());

                final XYPlot plot = chart.getXYPlot();
                for (int i = 0; i < plot.getDatasetCount(); i++) {
                    XYDataset test = plot.getDataset(i);
                    XYItemRenderer r = plot.getRenderer(i);
                    r.removeAnnotations();
                    if (test == dataset) {
                        NumberAxis ejeOrdenada = AxesList.get(i);
                        double y_max = ejeOrdenada.getUpperBound();
                        double y_min = ejeOrdenada.getLowerBound();
                        double x_max = abcissaAxis.getUpperBound();
                        double x_min = abcissaAxis.getLowerBound();
                        double angulo;
                        if (y > (y_max + y_min) / 2 && x > (x_max + x_min) / 2) {
                            angulo = 3.0 * Math.PI / 4.0;
                        } else if (y > (y_max + y_min) / 2 && x < (x_max + x_min) / 2) {
                            angulo = 1.0 * Math.PI / 4.0;
                        } else if (y < (y_max + y_min) / 2 && x < (x_max + x_min) / 2) {
                            angulo = 7.0 * Math.PI / 4.0;
                        } else {
                            angulo = 5.0 * Math.PI / 4.0;
                        }

                        CircleDrawer cd = new CircleDrawer((Color) r.getSeriesPaint(xyitem.getSeriesIndex()),
                                new BasicStroke(2.0f), null);
                        //XYAnnotation bestBid = new XYDrawableAnnotation(dataset.getXValue(xyitem.getSeriesIndex(), xyitem.getItem()), dataset.getYValue(xyitem.getSeriesIndex(), xyitem.getItem()), 11, 11, cd);
                        String txt = "X:" + abcissaFormat.format(x) + ", Y:" + ordinateFormat.format(y);
                        XYPointerAnnotation anotacion = new XYPointerAnnotation(txt,
                                dataset.getXValue(xyitem.getSeriesIndex(), xyitem.getItem()),
                                dataset.getYValue(xyitem.getSeriesIndex(), xyitem.getItem()), angulo);
                        anotacion.setTipRadius(10.0);
                        anotacion.setBaseRadius(35.0);
                        anotacion.setFont(new Font("SansSerif", Font.PLAIN, 10));

                        if (Long.parseLong((strChartBackgroundColor.replace("#", "")), 16) > 0xffffff / 2) {
                            anotacion.setPaint(Color.black);
                            anotacion.setArrowPaint(Color.black);
                        } else {
                            anotacion.setPaint(Color.white);
                            anotacion.setArrowPaint(Color.white);
                        }

                        //bestBid.setPaint((Color) r.getSeriesPaint(xyitem.getSeriesIndex()));
                        r.addAnnotation(anotacion);
                    }
                }

                //LabelValorVariable.setSize(LabelValorVariable.getPreferredSize());
            } catch (NullPointerException | ClassCastException ex) {

            }
        }
    });

    chartPanel.setPopupMenu(null);
    chartPanel.setBackground(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor)));

    SwingNode sn = new SwingNode();
    sn.setContent(chartPanel);
    chartFrame = new VBox();
    chartFrame.getChildren().addAll(sn, legendFrame);
    VBox.setVgrow(sn, Priority.ALWAYS);
    VBox.setVgrow(legendFrame, Priority.NEVER);

    chartFrame.getStylesheets().addAll(SwingChart.class.getResource("overlay-chart.css").toExternalForm());

    legendFrame.setStyle("marco: " + strBackgroundColor + ";-fx-background-color: marco;");

    MenuItem mi;
    mi = new MenuItem("Print");
    mi.setOnAction((ActionEvent t) -> {
        print(chartFrame);
    });
    contextMenuList.add(mi);

    sn.setOnMouseClicked((MouseEvent t) -> {
        if (menu != null) {
            menu.hide();
        }
        if (t.getClickCount() == 2) {
            backgroundEdition();
        }
    });

    mi = new MenuItem("Copy to clipboard");
    mi.setOnAction((ActionEvent t) -> {
        copyClipboard(chartFrame);
    });
    contextMenuList.add(mi);

    mi = new MenuItem("Export values");
    mi.setOnAction((ActionEvent t) -> {
        FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle("Export to file");
        fileChooser.getExtensionFilters()
                .addAll(new FileChooser.ExtensionFilter("Comma Separated Values", "*.csv"));

        Window w = null;
        try {
            w = parent.getScene().getWindow();
        } catch (NullPointerException e) {

        }
        File file = fileChooser.showSaveDialog(w);
        if (file != null) {
            export(file);
        }
    });
    contextMenuList.add(mi);

    chartFrame.setOnContextMenuRequested((ContextMenuEvent t) -> {
        if (menu != null) {
            menu.hide();
        }
        menu = new ContextMenu();
        menu.getItems().addAll(contextMenuList);
        menu.show(chartFrame, t.getScreenX(), t.getScreenY());
    });

}