org.jfree.chart.util.ExportUtils Java Examples

The following examples show how to use org.jfree.chart.util.ExportUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ChartViewer.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A handler for the export to JPEG option in the context menu.
 */
private void handleExportToJPEG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to JPEG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "JPEG", "jpg"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsJPEG(this.chart, (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
        }
    }        
}
 
Example #2
Source File: ChartViewer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A handler for the export to JPEG option in the context menu.
 */
private void handleExportToJPEG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to JPEG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "JPEG", "jpg"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsJPEG(this.chart, (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
        }
    }        
}
 
Example #3
Source File: ChartViewer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A handler for the export to PNG option in the context menu.
 */
private void handleExportToPNG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to PNG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Portable Network Graphics (PNG)", "png"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsPNG(this.chart, (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
        }
    }        
}
 
Example #4
Source File: ChartViewer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A handler for the export to JPEG option in the context menu.
 */
private void handleExportToJPEG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to JPEG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "JPEG", "jpg"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsJPEG(this.chart, (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
        }
    }        
}
 
Example #5
Source File: ChartViewer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A handler for the export to PNG option in the context menu.
 */
private void handleExportToPNG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to PNG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Portable Network Graphics (PNG)", "png"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsPNG(this.chart, (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
        }
    }        
}
 
Example #6
Source File: ChartViewer.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * A handler for the export to JPEG option in the context menu.
 */
private void handleExportToJPEG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to JPEG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "JPEG", "jpg"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsJPEG(this.chart, (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
        }
    }        
}
 
Example #7
Source File: ChartViewer.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * A handler for the export to PNG option in the context menu.
 */
private void handleExportToPNG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to PNG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Portable Network Graphics (PNG)", "png"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsPNG(this.chart, (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
        }
    }        
}
 
Example #8
Source File: ChartViewer.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * A handler for the export to JPEG option in the context menu.
 */
private void handleExportToJPEG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to JPEG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "JPEG", "jpg"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsJPEG(this.chart, (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
        }
    }        
}
 
Example #9
Source File: ChartViewer.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * A handler for the export to PNG option in the context menu.
 */
private void handleExportToPNG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to PNG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Portable Network Graphics (PNG)", "png"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsPNG(this.chart, (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
        }
    }        
}
 
Example #10
Source File: ChartViewer.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A handler for the export to PNG option in the context menu.
 */
private void handleExportToPNG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to PNG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Portable Network Graphics (PNG)", "png"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsPNG(this.chart, (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
        }
    }        
}
 
Example #11
Source File: TaChartViewer.java    From TAcharting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * A handler for the export to JPEG option in the context menu.
 */
private void handleExportToJPEG() {
    FileChooser chooser = new FileChooser();
    chooser.setTitle("Export to JPEG");
    FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter("JPEG", "jpg");
    chooser.getExtensionFilters().add(filter);
    File file = chooser.showSaveDialog(getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsJPEG(this.canvas.getChart(), (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
            throw new RuntimeException(ex);
        }
    }
}
 
Example #12
Source File: TaChartViewer.java    From TAcharting with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * A handler for the export to PNG option in the context menu.
 */
private void handleExportToPNG() {
    FileChooser chooser = new FileChooser();
    chooser.setTitle("Export to PNG");
    FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter(
            "Portable Network Graphics (PNG)", "png");
    chooser.getExtensionFilters().add(filter);
    File file = chooser.showSaveDialog(getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsPNG(this.canvas.getChart(), (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }
}
 
Example #13
Source File: ChartViewer.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A handler for the export to PNG option in the context menu.
 */
private void handleExportToPNG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to PNG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Portable Network Graphics (PNG)", "png"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsPNG(this.chart, (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
        }
    }        
}
 
Example #14
Source File: ChartViewer.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A handler for the export to JPEG option in the context menu.
 */
private void handleExportToJPEG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to JPEG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "JPEG", "jpg"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsJPEG(this.chart, (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
        }
    }        
}
 
Example #15
Source File: ChartViewer.java    From jfreechart-fx with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * A handler for the export to JPEG option in the context menu.
 */
private void handleExportToJPEG() {
    FileChooser chooser = new FileChooser();
    chooser.setTitle("Export to JPEG");
    FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter("JPEG", "*.jpg");
    chooser.getExtensionFilters().add(filter);
    File file = chooser.showSaveDialog(getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsJPEG(this.canvas.getChart(), (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
            throw new RuntimeException(ex);
        }
    }        
}
 
Example #16
Source File: ChartViewer.java    From jfreechart-fx with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * A handler for the export to PNG option in the context menu.
 */
private void handleExportToPNG() {
    FileChooser chooser = new FileChooser();
    chooser.setTitle("Export to PNG");
    FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter(
            "Portable Network Graphics (PNG)", "*.png");
    chooser.getExtensionFilters().add(filter);
    File file = chooser.showSaveDialog(getScene().getWindow());
    if (file != null) {
        try {
            ExportUtils.writeAsPNG(this.canvas.getChart(), (int) getWidth(),
                    (int) getHeight(), file);
        } catch (IOException ex) {
            // FIXME: show a dialog with the error
            throw new RuntimeException(ex);
        }
    }        
}
 
Example #17
Source File: ChartViewer.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A handler for the export to PDF option in the context menu.
 */
private void handleExportToPDF() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Portable Document Format (PDF)", "pdf"));
    fileChooser.setTitle("Export to PDF");
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        ExportUtils.writeAsPDF(this.chart, (int) getWidth(), 
                (int) getHeight(), file);
    } 
}
 
Example #18
Source File: ChartViewer.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * A handler for the export to SVG option in the context menu.
 */
private void handleExportToSVG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to SVG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Scalable Vector Graphics (SVG)", "svg"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        ExportUtils.writeAsSVG(this.chart, (int) getWidth(), 
                (int) getHeight(), file);
    }
}
 
Example #19
Source File: ChartViewer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * A handler for the export to SVG option in the context menu.
 */
private void handleExportToSVG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to SVG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Scalable Vector Graphics (SVG)", "svg"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        ExportUtils.writeAsSVG(this.chart, (int) getWidth(), 
                (int) getHeight(), file);
    }
}
 
Example #20
Source File: ChartViewer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * A handler for the export to PDF option in the context menu.
 */
private void handleExportToPDF() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Portable Document Format (PDF)", "pdf"));
    fileChooser.setTitle("Export to PDF");
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        ExportUtils.writeAsPDF(this.chart, (int) getWidth(), 
                (int) getHeight(), file);
    } 
}
 
Example #21
Source File: ChartViewer.java    From jfreechart-fx with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Creates the context menu.
 * 
 * @return The context menu.
 */
private ContextMenu createContextMenu() {
    final ContextMenu menu = new ContextMenu();
    menu.setAutoHide(true);
    Menu export = new Menu("Export As");
    
    MenuItem pngItem = new MenuItem("PNG...");
    pngItem.setOnAction(e -> handleExportToPNG());        
    export.getItems().add(pngItem);
    
    MenuItem jpegItem = new MenuItem("JPEG...");
    jpegItem.setOnAction(e -> handleExportToJPEG());        
    export.getItems().add(jpegItem);
    
    if (ExportUtils.isOrsonPDFAvailable()) {
        MenuItem pdfItem = new MenuItem("PDF...");
        pdfItem.setOnAction(e -> handleExportToPDF());
        export.getItems().add(pdfItem);
    }
    if (ExportUtils.isJFreeSVGAvailable()) {
        MenuItem svgItem = new MenuItem("SVG...");
        svgItem.setOnAction(e -> handleExportToSVG());
        export.getItems().add(svgItem);        
    }
    menu.getItems().add(export);
    return menu;
}
 
Example #22
Source File: ChartViewer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * A handler for the export to SVG option in the context menu.
 */
private void handleExportToSVG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to SVG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Scalable Vector Graphics (SVG)", "svg"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        ExportUtils.writeAsSVG(this.chart, (int) getWidth(), 
                (int) getHeight(), file);
    }
}
 
Example #23
Source File: ChartViewer.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * A handler for the export to PDF option in the context menu.
 */
private void handleExportToPDF() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Portable Document Format (PDF)", "pdf"));
    fileChooser.setTitle("Export to PDF");
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        ExportUtils.writeAsPDF(this.chart, (int) getWidth(), 
                (int) getHeight(), file);
    } 
}
 
Example #24
Source File: ChartViewer.java    From jfreechart-fx with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * A handler for the export to PDF option in the context menu.
 */
private void handleExportToPDF() {
    FileChooser chooser = new FileChooser();
    chooser.setTitle("Export to PDF");
    FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter(
            "Portable Document Format (PDF)", "*.pdf");
    chooser.getExtensionFilters().add(filter);
    File file = chooser.showSaveDialog(getScene().getWindow());
    if (file != null) {
        ExportUtils.writeAsPDF(this.canvas.getChart(), (int) getWidth(), 
                (int) getHeight(), file);
    } 
}
 
Example #25
Source File: ChartViewer.java    From jfreechart-fx with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * A handler for the export to SVG option in the context menu.
 */
private void handleExportToSVG() {
    FileChooser chooser = new FileChooser();
    chooser.setTitle("Export to SVG");
    FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter(
            "Scalable Vector Graphics (SVG)", "*.svg");
    chooser.getExtensionFilters().add(filter);
    File file = chooser.showSaveDialog(getScene().getWindow());
    if (file != null) {
        ExportUtils.writeAsSVG(this.canvas.getChart(), (int) getWidth(), 
                (int) getHeight(), file);
    }
}
 
Example #26
Source File: ChartViewer.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * A handler for the export to SVG option in the context menu.
 */
private void handleExportToSVG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to SVG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Scalable Vector Graphics (SVG)", "svg"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        ExportUtils.writeAsSVG(this.chart, (int) getWidth(), 
                (int) getHeight(), file);
    }
}
 
Example #27
Source File: TaChartViewer.java    From TAcharting with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * A handler for the export to SVG option in the context menu.
 */
private void handleExportToSVG() {
    FileChooser chooser = new FileChooser();
    chooser.setTitle("Export to SVG");
    FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter(
            "Scalable Vector Graphics (SVG)", "svg");
    chooser.getExtensionFilters().add(filter);
    File file = chooser.showSaveDialog(getScene().getWindow());
    if (file != null) {
        ExportUtils.writeAsSVG(this.canvas.getChart(), (int) getWidth(),
                (int) getHeight(), file);
    }
}
 
Example #28
Source File: ChartViewer.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * A handler for the export to SVG option in the context menu.
 */
private void handleExportToSVG() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setTitle("Export to SVG");
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Scalable Vector Graphics (SVG)", "svg"));
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        ExportUtils.writeAsSVG(this.chart, (int) getWidth(), 
                (int) getHeight(), file);
    }
}
 
Example #29
Source File: ChartViewer.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * A handler for the export to PDF option in the context menu.
 */
private void handleExportToPDF() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Portable Document Format (PDF)", "pdf"));
    fileChooser.setTitle("Export to PDF");
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        ExportUtils.writeAsPDF(this.chart, (int) getWidth(), 
                (int) getHeight(), file);
    } 
}
 
Example #30
Source File: ChartViewer.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * A handler for the export to PDF option in the context menu.
 */
private void handleExportToPDF() {
    FileChooser fileChooser = new FileChooser();
    fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(
            "Portable Document Format (PDF)", "pdf"));
    fileChooser.setTitle("Export to PDF");
    File file = fileChooser.showSaveDialog(this.getScene().getWindow());
    if (file != null) {
        ExportUtils.writeAsPDF(this.chart, (int) getWidth(), 
                (int) getHeight(), file);
    } 
}