Example usage for org.jfree.chart ChartPanel DEFAULT_BUFFER_USED

List of usage examples for org.jfree.chart ChartPanel DEFAULT_BUFFER_USED

Introduction

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

Prototype

boolean DEFAULT_BUFFER_USED

To view the source code for org.jfree.chart ChartPanel DEFAULT_BUFFER_USED.

Click Source Link

Document

Default setting for buffer usage.

Usage

From source file:beadAnalyzer.DrawPoints.java

public static JFrame display(final JFreeChart chart, final Dimension d) {
    final JPanel panel = new JPanel();
    final ChartPanel chartPanel = new ChartPanel(chart, d.width - 10, d.height - 35,
            ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MINIMUM_DRAW_HEIGHT,
            ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH, ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT,
            ChartPanel.DEFAULT_BUFFER_USED, true, // properties
            true, // save
            true, // print
            true, // zoom
            true // tooltips
    );//w  w w . j a va 2 s.c  om
    panel.add(chartPanel);

    final JFrame frame = new JFrame();
    frame.setContentPane(panel);
    frame.validate();
    frame.setSize(d);

    frame.setVisible(true);
    return frame;
}

From source file:org.forester.archaeopteryx.TreePanel.java

final private void showBranchDataPopup(final MouseEvent e, final PhylogenyNode node) {
    try {//w  w w .  ja va  2  s  .  c om
        String[] histdata = null;
        short lines = 10;
        // show inserted species on branch
        if (!(((Annotation) node.getNodeData().getSequences().get(0).getAnnotation(0)).getDesc()
                .length() < 10)) { // as long as there are no branch names longer than 9 characters, this is going to work
            lines++;
            _popup_buffer.delete(0, _popup_buffer.length());
            histdata = ((Annotation) node.getNodeData().getSequences().get(0).getAnnotation(0)).getDesc()
                    .split(",");
            _popup_buffer
                    .append("RAxml Weights Histogram " + node.getNodeData().getSequence(0).getName() + "\n");

            String branch_data = "";
            // parse the histogram
            Pattern p = Pattern.compile("\\s*\\d\\.\\d\\s-\\s\\d\\.\\d:\\s[\\|\\.]*\\s*\\d+");
            for (int i = 0; i < histdata.length; i++) {

                //##################################
                // Parse Node Description a[i] here!

                Matcher m = p.matcher(histdata[i]);
                if (m.matches()) {
                    branch_data = branch_data + histdata[i] + "\n";

                    //   System.out.println(a[i]);
                }

            }
            _popup_buffer.append(branch_data);

            //_popup_buffer.append(((Annotation)node.getNodeData().getSequence().getAnnotation(0)).getDesc());     
        } else if (node.getNodeData().isHasSequence()) {
            _popup_buffer.delete(0, _popup_buffer.length());
            _popup_buffer.append(node.getNodeData().getSequence(0).getName());
        }

        if (_popup_buffer.length() > 0) {
            if (!getConfiguration().isUseNativeUI()) {
                _rollover_popup.setBorder(BorderFactory.createLineBorder(getTreeColorSet().getBranchColor()));
                _rollover_popup.setBackground(getTreeColorSet().getBackgroundColor());
                if (isInFoundNodes(node)) {
                    _rollover_popup.setForeground(getTreeColorSet().getFoundColor());
                } else if (getControlPanel().isColorAccordingToTaxonomy()) {
                    _rollover_popup.setForeground(getTaxonomyBasedColor(node));
                } else {
                    _rollover_popup.setForeground(getTreeColorSet().getSequenceColor());
                }
            } else {
                _rollover_popup.setBorder(BorderFactory.createLineBorder(Color.BLACK));
            }

            CategoryDataset data = createDataset(histdata);
            JFreeChart histogram = createChart(data, node.getNodeData().getSequence(0).getName());
            _chart_panel = new ChartPanel(histogram, 300, 200, ChartPanel.DEFAULT_MINIMUM_DRAW_WIDTH,
                    ChartPanel.DEFAULT_MINIMUM_DRAW_HEIGHT, ChartPanel.DEFAULT_MAXIMUM_DRAW_WIDTH,
                    ChartPanel.DEFAULT_MAXIMUM_DRAW_HEIGHT, ChartPanel.DEFAULT_BUFFER_USED, false, false, false,
                    false, true);
            _rollover_popup.setText(_popup_buffer.toString());//_popup_buffer.toString() );
            _node_desc_popup = PopupFactory.getSharedInstance().getPopup(null, _chart_panel,
                    e.getLocationOnScreen().x + 10, e.getLocationOnScreen().y - (10));
            _node_desc_popup.show();
        }
    } catch (final Exception ex) {
        // Do nothing.
    }
}