Example usage for org.jfree.chart ChartTransferable ChartTransferable

List of usage examples for org.jfree.chart ChartTransferable ChartTransferable

Introduction

In this page you can find the example usage for org.jfree.chart ChartTransferable ChartTransferable.

Prototype

public ChartTransferable(JFreeChart chart, int width, int height) 

Source Link

Document

Creates a new chart selection.

Usage

From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.actions.CopyChartAction.java

/**
 * Copies the current chart to the system clipboard.
 *//*from  w  w w.  ja v a 2  s.  com*/
public static synchronized void copyChart(final JFreeChartPlotEngine engine) {
    Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    Insets insets = engine.getChartPanel().getInsets();
    int w = engine.getChartPanel().getWidth() - insets.left - insets.right;
    int h = engine.getChartPanel().getHeight() - insets.top - insets.bottom;
    ChartTransferable selection = new ChartTransferable(engine.getChartPanel().getChart(), w, h);
    systemClipboard.setContents(selection, null);
}

From source file:com.rapidminer.gui.plotter.charts.AbstractChartPanel.java

/**
 * Copies the current chart to the system clipboard.
 * // www  .ja  v  a2 s  .  c  o m
 * @since 1.0.13
 */

@Override
public void doCopy() {
    Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    Insets insets = getInsets();
    int w = getWidth() - insets.left - insets.right;
    int h = getHeight() - insets.top - insets.bottom;
    ChartTransferable selection = new ChartTransferable(this.chart, w, h);
    systemClipboard.setContents(selection, null);
}