Example usage for java.awt Graphics setColor

List of usage examples for java.awt Graphics setColor

Introduction

In this page you can find the example usage for java.awt Graphics setColor.

Prototype

public abstract void setColor(Color c);

Source Link

Document

Sets this graphics context's current color to the specified color.

Usage

From source file:org.eurocarbdb.application.glycoworkbench.plugin.reporting.AnnotationReportCanvas.java

private void xorRectangle(Point start_point, Point end_point) {
    Graphics g = getGraphics();
    g.setXORMode(Color.white);/*  w  w w. ja  v a 2  s .c  om*/
    g.setColor(Color.gray);

    Rectangle rect = makeRectangle(start_point, end_point);
    g.drawRect(rect.x, rect.y, rect.width, rect.height);
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.reporting.AnnotationReportCanvas.java

private void xorSelections(Point start_point, Point end_point) {
    Graphics g = getGraphics();
    g.setXORMode(Color.white);/*from  w ww. j a  va 2 s.  c om*/
    g.setColor(Color.gray);

    int dx = end_point.x - start_point.x;
    int dy = end_point.y - start_point.y;
    for (AnnotationObject a : selections) {
        Rectangle rect = rectangles_complete.get(a);
        g.drawRect(dx + rect.x, dy + rect.y, rect.width, rect.height);
    }
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.reporting.AnnotationReportCanvas.java

private void xorConnection(AnnotationObject selection, Point start_point, Point end_point) {

    Graphics g = getGraphics();
    g.setXORMode(Color.white);/*from  w ww  .  j  a  v  a 2s.co m*/
    g.setColor(Color.gray);

    Rectangle rect = rectangles_complete.get(selection);
    Point2D peak = dataToScreenCoords(selection.getPeakPoint());

    // select anchor
    Point2D anchor = computeAnchor(rect, end_point, peak);

    // draw connection
    g.drawLine((int) anchor.getX(), (int) anchor.getY(), (int) end_point.getX(), (int) end_point.getY());
    g.drawLine((int) end_point.getX(), (int) end_point.getY(), (int) peak.getX(), (int) peak.getY());
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.reporting.AnnotationReportCanvas.java

private void xorResizing(AnnotationObject selection, Point start_point, Point end_point) {
    Graphics g = getGraphics();
    g.setXORMode(Color.white);/*ww  w . j av a2  s  .  co  m*/
    g.setColor(Color.gray);

    Rectangle rect = rectangles.get(selection);

    double scale = 1.;
    if (start_point.x > midx(rect)) {
        scale = Math.min((double) (end_point.x - start_point.x + rect.width / 2.) / (double) (rect.width / 2.),
                (double) (start_point.y - end_point.y + rect.height) / (double) (rect.height));
    } else {
        scale = Math.min((double) (start_point.x - end_point.x + rect.width / 2.) / (double) (rect.width / 2.),
                (double) (start_point.y - end_point.y + rect.height) / (double) (rect.height));
    }
    scale = Math.max(0., scale);

    g.drawRect((int) (midx(rect) - rect.width * scale / 2.), (int) (bottom(rect) - rect.height * scale),
            (int) (rect.width * scale), (int) (rect.height * scale));
}

From source file:edu.uci.ics.jung.samples.PerspectiveVertexImageShaperDemo.java

/**
 * create an instance of a simple graph with controls to
 * demo the zoom features.//from  ww w  .  j  a  va  2s  . c om
 * 
 */
@SuppressWarnings("serial")
public PerspectiveVertexImageShaperDemo() {

    // create a simple graph for the demo
    graph = new DirectedSparseMultigraph<Number, Number>();
    Number[] vertices = createVertices(11);

    // a Map for the labels
    Map<Number, String> map = new HashMap<Number, String>();
    for (int i = 0; i < vertices.length; i++) {
        map.put(vertices[i], iconNames[i % iconNames.length]);
    }

    // a Map for the Icons
    Map<Number, Icon> iconMap = new HashMap<Number, Icon>();
    for (int i = 0; i < vertices.length; i++) {
        String name = "/images/topic" + iconNames[i] + ".gif";
        try {
            Icon icon = new LayeredIcon(
                    new ImageIcon(PerspectiveVertexImageShaperDemo.class.getResource(name)).getImage());
            iconMap.put(vertices[i], icon);
        } catch (Exception ex) {
            System.err.println("You need slashdoticons.jar in your classpath to see the image " + name);
        }
    }

    createEdges(vertices);

    final VertexStringerImpl<Number> vertexStringerImpl = new VertexStringerImpl<Number>(map);

    final VertexIconShapeTransformer<Number> vertexImageShapeFunction = new VertexIconShapeTransformer<Number>(
            new EllipseVertexShapeTransformer<Number>());

    FRLayout<Number, Number> layout = new FRLayout<Number, Number>(graph);
    layout.setMaxIterations(100);
    vv = new VisualizationViewer<Number, Number>(layout, new Dimension(400, 400));

    vv.setBackground(Color.decode("0xffffdd"));
    final DefaultVertexIconTransformer<Number> vertexIconFunction = new DefaultVertexIconTransformer<Number>();
    vertexImageShapeFunction.setIconMap(iconMap);
    vertexIconFunction.setIconMap(iconMap);
    vv.getRenderContext().setVertexShapeTransformer(vertexImageShapeFunction);
    vv.getRenderContext().setVertexIconTransformer(vertexIconFunction);
    vv.getRenderContext().setVertexLabelTransformer(vertexStringerImpl);
    PickedState<Number> ps = vv.getPickedVertexState();
    ps.addItemListener(new PickWithIconListener(vertexIconFunction));

    vv.addPostRenderPaintable(new VisualizationServer.Paintable() {
        int x;
        int y;
        Font font;
        FontMetrics metrics;
        int swidth;
        int sheight;
        String str = "Thank You, slashdot.org, for the images!";

        public void paint(Graphics g) {
            Dimension d = vv.getSize();
            if (font == null) {
                font = new Font(g.getFont().getName(), Font.BOLD, 20);
                metrics = g.getFontMetrics(font);
                swidth = metrics.stringWidth(str);
                sheight = metrics.getMaxAscent() + metrics.getMaxDescent();
                x = (d.width - swidth) / 2;
                y = (int) (d.height - sheight * 1.5);
            }
            g.setFont(font);
            Color oldColor = g.getColor();
            g.setColor(Color.lightGray);
            g.drawString(str, x, y);
            g.setColor(oldColor);
        }

        public boolean useTransform() {
            return false;
        }
    });

    // add a listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller<Number>());

    Container content = getContentPane();
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    content.add(panel);

    final DefaultModalGraphMouse<Number, Number> graphMouse = new DefaultModalGraphMouse<Number, Number>();

    vv.setGraphMouse(graphMouse);

    this.viewSupport = new PerspectiveImageLensSupport<Number, Number>(vv);
    this.layoutSupport = new PerspectiveLayoutTransformSupport<Number, Number>(vv);

    final ScalingControl scaler = new CrossoverScalingControl();

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 0.9f, vv.getCenter());
        }
    });
    final JSlider horizontalSlider = new JSlider(-120, 120, 0) {

        /* (non-Javadoc)
         * @see javax.swing.JComponent#getPreferredSize()
         */
        @Override
        public Dimension getPreferredSize() {
            return new Dimension(80, super.getPreferredSize().height);
        }
    };

    final JSlider verticalSlider = new JSlider(-120, 120, 0) {

        /* (non-Javadoc)
         * @see javax.swing.JComponent#getPreferredSize()
         */
        @Override
        public Dimension getPreferredSize() {
            return new Dimension(super.getPreferredSize().width, 80);
        }
    };
    verticalSlider.setOrientation(JSlider.VERTICAL);
    final ChangeListener changeListener = new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            int vval = -verticalSlider.getValue();
            int hval = horizontalSlider.getValue();

            Dimension d = vv.getSize();
            PerspectiveTransform pt = null;
            pt = PerspectiveTransform.getQuadToQuad(vval, hval, d.width - vval, -hval, d.width + vval,
                    d.height + hval, -vval, d.height - hval,

                    0, 0, d.width, 0, d.width, d.height, 0, d.height);

            viewSupport.getPerspectiveTransformer().setPerspectiveTransform(pt);
            layoutSupport.getPerspectiveTransformer().setPerspectiveTransform(pt);
            vv.repaint();
        }
    };
    horizontalSlider.addChangeListener(changeListener);
    verticalSlider.addChangeListener(changeListener);

    JPanel perspectivePanel = new JPanel(new BorderLayout());
    JPanel perspectiveCenterPanel = new JPanel(new BorderLayout());
    perspectivePanel.setBorder(BorderFactory.createTitledBorder("Perspective Controls"));
    final JButton center = new JButton("Center");
    center.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            horizontalSlider.setValue(0);
            verticalSlider.setValue(0);
        }
    });

    final JCheckBox noText = new JCheckBox("No Text");
    noText.addItemListener(new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            JCheckBox cb = (JCheckBox) e.getSource();
            vertexStringerImpl.setEnabled(!cb.isSelected());
            vv.repaint();
        }
    });
    JPanel centerPanel = new JPanel();
    centerPanel.add(noText);

    ButtonGroup radio = new ButtonGroup();
    JRadioButton none = new JRadioButton("None");
    none.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            boolean selected = e.getStateChange() == ItemEvent.SELECTED;
            if (selected) {
                if (viewSupport != null) {
                    viewSupport.deactivate();
                }
                if (layoutSupport != null) {
                    layoutSupport.deactivate();
                }
            }
            center.setEnabled(!selected);
            horizontalSlider.setEnabled(!selected);
            verticalSlider.setEnabled(!selected);
        }
    });
    none.setSelected(true);

    JRadioButton hyperView = new JRadioButton("View");
    hyperView.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            viewSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });

    JRadioButton hyperModel = new JRadioButton("Layout");
    hyperModel.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            layoutSupport.activate(e.getStateChange() == ItemEvent.SELECTED);
        }
    });
    radio.add(none);
    radio.add(hyperView);
    radio.add(hyperModel);

    JMenuBar menubar = new JMenuBar();
    JMenu modeMenu = graphMouse.getModeMenu();
    menubar.add(modeMenu);

    panel.setCorner(menubar);

    JPanel scaleGrid = new JPanel(new GridLayout(2, 0));
    scaleGrid.setBorder(BorderFactory.createTitledBorder("Zoom"));
    JPanel controls = new JPanel(new BorderLayout());
    scaleGrid.add(plus);
    scaleGrid.add(minus);
    controls.add(scaleGrid, BorderLayout.WEST);

    JPanel lensPanel = new JPanel(new GridLayout(2, 0));
    lensPanel.add(none);
    lensPanel.add(hyperView);
    lensPanel.add(hyperModel);

    perspectivePanel.add(lensPanel, BorderLayout.WEST);
    perspectiveCenterPanel.add(horizontalSlider, BorderLayout.SOUTH);
    perspectivePanel.add(verticalSlider, BorderLayout.EAST);
    perspectiveCenterPanel.add(center);
    perspectivePanel.add(perspectiveCenterPanel);
    controls.add(perspectivePanel, BorderLayout.EAST);

    controls.add(centerPanel);
    content.add(controls, BorderLayout.SOUTH);
}

From source file:adams.gui.visualization.stats.paintlet.Exponential.java

/**
 * The paint routine of the paintlet.// w ww . j  a  v  a2s.c  om
 *
 * @param g      the graphics context to use for painting
 * @param moment   what {@link PaintMoment} is currently being painted
 */
@Override
protected void doPerformPaint(Graphics g, PaintMoment moment) {
    if ((m_Data != null) && (m_Sorted != null)) {
        GUIHelper.configureAntiAliasing(g, m_AntiAliasingEnabled);

        for (int i = 0; i < m_Sorted.length; i++) {
            Graphics2D g2d = (Graphics2D) g;
            //If data points are to be filled
            if (m_Fill) {
                g2d.setColor(m_FillColor);
                g2d.setStroke(new BasicStroke(0));
                g2d.fillOval(m_AxisBottom.valueToPos(m_Sorted[i]) - m_Size / 2,
                        m_AxisLeft.valueToPos(m_TransformedY[i]) - m_Size / 2, m_Size, m_Size);
            }
            //outline of data point
            g2d.setStroke(new BasicStroke(m_StrokeThickness));
            g2d.setColor(m_Color);
            g2d.drawOval(m_AxisBottom.valueToPos(m_Sorted[i]) - m_Size / 2,
                    m_AxisLeft.valueToPos(m_TransformedY[i]) - m_Size / 2, m_Size, m_Size);
        }
        //if drawing regression fit diagonal
        if (m_RegressionLine) {
            g.setColor(Color.BLACK);
            double[] newData = new double[m_Sorted.length];
            for (int i = 0; i < m_Sorted.length; i++) {
                newData[i] = Math.log(m_Sorted[i]);
            }
            ExponentialDistributionImpl ex = new ExponentialDistributionImpl(StatUtils.mean(newData));
            //draw the expected diagonal line using the exponential distribution
            for (int i = 0; i < m_Sorted.length - 1; i++) {
                double prob1;
                try {
                    prob1 = ex.cumulativeProbability(newData[i]);
                } catch (MathException e) {
                    prob1 = 0;
                }
                double prob2;
                try {
                    prob2 = ex.cumulativeProbability(newData[i + 1]);
                } catch (MathException e) {
                    prob2 = 0;
                }
                double p1 = -Math.log(1 - prob1);
                double p2 = -Math.log(1 - prob2);
                g.drawLine(m_AxisBottom.valueToPos(m_Sorted[i]), m_AxisLeft.valueToPos(p1),
                        m_AxisBottom.valueToPos(m_Sorted[i + 1]), m_AxisLeft.valueToPos(p2));
            }
        }
    }
}

From source file:de.tor.tribes.ui.views.DSWorkbenchReportFrame.java

@Override
public void actionPerformed(ActionEvent e) {
    ReportTableTab activeTab = getActiveTab();
    if (e.getActionCommand() != null && activeTab != null) {
        if (e.getActionCommand().equals("Copy")) {
            activeTab.transferSelection(ReportTableTab.TRANSFER_TYPE.COPY_TO_INTERNAL_CLIPBOARD);
        } else if (e.getActionCommand().equals("BBCopy")) {
            activeTab.transferSelection(ReportTableTab.TRANSFER_TYPE.CLIPBOARD_BB);
        } else if (e.getActionCommand().equals("Cut")) {
            activeTab.transferSelection(ReportTableTab.TRANSFER_TYPE.CUT_TO_INTERNAL_CLIPBOARD);
        } else if (e.getActionCommand().equals("Paste")) {
            activeTab.transferSelection(ReportTableTab.TRANSFER_TYPE.FROM_INTERNAL_CLIPBOARD);
        } else if (e.getActionCommand().equals("Delete")) {
            activeTab.deleteSelection(true);
        } else if (e.getActionCommand().equals("Find")) {
            BufferedImage back = ImageUtils.createCompatibleBufferedImage(3, 3, BufferedImage.TRANSLUCENT);
            Graphics g = back.getGraphics();
            g.setColor(new Color(120, 120, 120, 120));
            g.fillRect(0, 0, back.getWidth(), back.getHeight());
            g.setColor(new Color(120, 120, 120));
            g.drawLine(0, 0, 3, 3);//www.j  a v a2  s . c  om
            g.dispose();
            TexturePaint paint = new TexturePaint(back,
                    new Rectangle2D.Double(0, 0, back.getWidth(), back.getHeight()));
            jxSearchPane.setBackgroundPainter(new MattePainter(paint));
            DefaultListModel model = new DefaultListModel();

            for (int i = 0; i < activeTab.getReportTable().getColumnCount(); i++) {
                TableColumnExt col = activeTab.getReportTable().getColumnExt(i);
                if (col.isVisible()) {
                    if (!col.getTitle().equals("Status") && !col.getTitle().equals("Typ")
                            && !col.getTitle().equals("Sonstiges")) {
                        model.addElement(col.getTitle());
                    }
                }
            }
            jXColumnList.setModel(model);
            jXColumnList.setSelectedIndex(0);
            jxSearchPane.setVisible(true);
        }
    }
}

From source file:org.kineticsystem.commons.layout.TetrisLayout.java

/**
 * <p>This method draws the layout on a graphics context. Used to test the
 * layout during the design process. Override the 
 * <code>paint(Graphics g)</code> of the container to display the layout.
 * Here is an example code where <code>layout</code> is a 
 * <code>TestrisLayout</code>.</p>
 * <pre>//  ww  w .j a  v a2 s .  co m
 * JPanel panel = new JPanel(layout) {
 *     public void paint(Graphics g) {
 *         super.paint(g);
 *         ((TetrisLayout) getLayout()).drawLayout(g);
 *     }
 * };
 * </pre>
 * @param g The graphics context.
 */
public void drawLayout(Graphics g) {

    // Draw the spanning layout.

    g.setColor(spanningLayoutColor);

    Insets insets = container.getInsets();
    Dimension size = container.getSize();

    int actualGapFreeWidth = Math
            .max(size.width - insets.left - insets.right - cGaps[cBars.length].getIncSize(), 0);
    int actualGapFreeHeight = Math
            .max(size.height - insets.top - insets.bottom - rGaps[rBars.length].getIncSize(), 0);

    for (Cell cell : constraintsMap.values()) {

        if (cell != null) {

            /*
             * Calculate the center of the first and the last cell spanned
             * by the current component.
             */

            int cx0 = (int) Math.round((cSizes[cell.getCol()].evaluate(actualGapFreeWidth)
                    + cSizes[cell.getCol() + 1].evaluate(actualGapFreeWidth)) / 2);
            int cy0 = (int) Math.round((rSizes[cell.getRow()].evaluate(actualGapFreeHeight)
                    + rSizes[cell.getRow() + 1].evaluate(actualGapFreeHeight)) / 2);
            int cx1 = (int) Math.round((cSizes[cell.getCol() + cell.getCols()].evaluate(actualGapFreeWidth)
                    + cSizes[cell.getCol() + cell.getCols() - 1].evaluate(actualGapFreeWidth)) / 2) + 1;
            int cy1 = (int) Math.round((rSizes[cell.getRow() + cell.getRows()].evaluate(actualGapFreeHeight)
                    + rSizes[cell.getRow() + cell.getRows() - 1].evaluate(actualGapFreeHeight)) / 2) + 1;

            // Actual cell dimension.

            int w = cx1 - cx0;
            int h = cy1 - cy0;

            // Component position correction.

            int xCorrection = insets.left + cGaps[cell.getCol()].getIncSize();
            int yCorrection = insets.top + rGaps[cell.getRow()].getIncSize();

            // Component dimension correction.

            int wCorrection = cGaps[cell.getCol() + cell.getCols() - 1].getIncSize()
                    - cGaps[cell.getCol()].getIncSize();
            int hCorrection = rGaps[cell.getRow() + cell.getRows() - 1].getIncSize()
                    - rGaps[cell.getRow()].getIncSize();

            cx0 += xCorrection;
            cy0 += yCorrection;
            w += wCorrection;
            h += hCorrection;

            int radius = 6;
            g.drawRect(cx0 + 1, cy0 + 1, w - 1, h - 1);
            g.drawOval(cx0 + 1 - radius / 2, cy0 + 1 - radius / 2, radius, radius);
            g.drawOval(cx0 + w - radius / 2, cy0 + h - radius / 2, radius, radius);
        }
    }

    // Draw the internal layout.

    g.setColor(internalLayoutColor);

    int x2 = (int) Math.round(cSizes[cSizes.length - 1].evaluate(actualGapFreeWidth)
            + cGaps[cSizes.length - 1].getIncSize() + insets.left) - 1;
    int y2 = (int) Math.round(rSizes[rSizes.length - 1].evaluate(actualGapFreeHeight)
            + rGaps[rSizes.length - 1].getIncSize() + insets.top) - 1;

    for (int i = 1; i < cSizes.length - 1; i++) {
        int x = (int) Math
                .round(cSizes[i].evaluate(actualGapFreeWidth) + insets.left + cGaps[i - 1].getIncSize());
        g.drawLine(x, insets.top, x, y2);
        g.drawLine(x + cGaps[i].getSize(), insets.top, x + cGaps[i].getSize(), y2);
    }
    for (int i = 1; i < rSizes.length - 1; i++) {
        int y = (int) Math
                .round(rSizes[i].evaluate(actualGapFreeHeight) + insets.top + rGaps[i - 1].getIncSize());
        g.drawLine(insets.left, y, x2, y);
        g.drawLine(insets.left, y + rGaps[i].getSize(), x2, y + rGaps[i].getSize());
    }

    // Draw the layout internal frame.

    g.setColor(externalLayoutColor);
    g.drawRect(insets.left, insets.top, x2 - insets.left, y2 - insets.top);

    // Draw layout external frame.

    g.drawRect(0, 0, x2 + insets.right, y2 + insets.bottom);
}

From source file:cish.CISH.java

@Override
public void drawInformationPreNuclei(TMAspot ts, Graphics g, double z, int x_min, int y_min, int x_max,
        int y_max) {
    if (tss != null && !tss.isEmpty() && jCheckBox1.isSelected()) {
        int i = tss.indexOf(ts);
        if (i >= 0) {
            double x, y;
            int r = getParam_PointSignalRadius();
            for (int[] coords : ps[i]) {
                x = coords[0];// w w  w . ja v  a 2  s. c  o  m
                y = coords[1];
                if (x >= x_min && y >= y_min && x < x_max && y < y_max) {
                    g.setColor(new Color(coords[2], coords[3], coords[4]));
                    g.drawRect((int) ((x - r) * z), (int) ((y - r) * z), (int) (2 * r * z), (int) (2 * r * z));
                }
            }
        }
    }
}

From source file:adams.gui.visualization.stats.paintlet.Gamma.java

/**
 * The paint routine of the paintlet./*  w w  w  .  j ava  2s.c o m*/
 *
 * @param g      the graphics context to use for painting
 * @param moment   what {@link PaintMoment} is currently being painted
 */
@Override
protected void doPerformPaint(Graphics g, PaintMoment moment) {
    if ((m_Data != null) && (m_Sorted != null) && m_Shape != -1.0) {
        GUIHelper.configureAntiAliasing(g, m_AntiAliasingEnabled);

        for (int i = 0; i < m_Sorted.length; i++) {
            Graphics2D g2d = (Graphics2D) g;
            //If data points are to be filled
            if (m_Fill) {
                g2d.setColor(m_FillColor);
                g2d.setStroke(new BasicStroke(0));
                g2d.fillOval(m_AxisBottom.valueToPos(m_Sorted[i]) - m_Size / 2,
                        m_AxisLeft.valueToPos(m_TransformedY[i]) - m_Size / 2, m_Size, m_Size);
            }
            //outline of data point
            g2d.setStroke(new BasicStroke(m_StrokeThickness));
            g2d.setColor(m_Color);
            g2d.drawOval(m_AxisBottom.valueToPos(m_Sorted[i]) - m_Size / 2,
                    m_AxisLeft.valueToPos(m_TransformedY[i]) - m_Size / 2, m_Size, m_Size);
        }

        //If drawing regression fit diagonal
        if (m_RegressionLine) {
            g.setColor(Color.BLACK);
            double[] newData = new double[m_Sorted.length];
            for (int i = 0; i < m_Sorted.length; i++) {
                newData[i] = Math.log(m_Sorted[i]);
            }
            GammaDistributionImpl gd = new GammaDistributionImpl(m_Shape, m_Scale);
            //draw the expected diagonal line using the gamma distribution
            for (int i = 0; i < m_Sorted.length - 1; i++) {
                double p1;
                try {
                    p1 = gd.cumulativeProbability(newData[i]);
                } catch (MathException e) {
                    p1 = 0;
                }
                double p2;
                try {
                    p2 = gd.cumulativeProbability(newData[i + 1]);
                } catch (MathException e) {
                    p2 = 0;
                }
                g.drawLine(m_AxisBottom.valueToPos(m_Sorted[i]), m_AxisLeft.valueToPos(p1),
                        m_AxisBottom.valueToPos(m_Sorted[i + 1]), m_AxisLeft.valueToPos(p2));
            }
        }
    }
}