Example usage for java.awt Color LIGHT_GRAY

List of usage examples for java.awt Color LIGHT_GRAY

Introduction

In this page you can find the example usage for java.awt Color LIGHT_GRAY.

Prototype

Color LIGHT_GRAY

To view the source code for java.awt Color LIGHT_GRAY.

Click Source Link

Document

The color light gray.

Usage

From source file:net.sf.dynamicreports.test.jasper.chart.XyBlockChartTest.java

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);/*  ww w  .j  av  a 2  s.c  o m*/

    JFreeChart chart = getChart("summary.chart1", 0);
    XYItemRenderer renderer = chart.getXYPlot().getRenderer();
    Assert.assertEquals("renderer", XYBlockRenderer.class, renderer.getClass());
    Assert.assertEquals("block width", 1.1, ((XYBlockRenderer) renderer).getBlockWidth());
    Assert.assertEquals("block height", 0.9, ((XYBlockRenderer) renderer).getBlockHeight());
    Assert.assertEquals("block anchor", org.jfree.ui.RectangleAnchor.BOTTOM_LEFT,
            ((XYBlockRenderer) renderer).getBlockAnchor());

    Assert.assertEquals("paintScale", LookupPaintScale.class,
            ((XYBlockRenderer) renderer).getPaintScale().getClass());
    LookupPaintScale paintScale = (LookupPaintScale) ((XYBlockRenderer) renderer).getPaintScale();
    Assert.assertEquals("paintScale default lower bound", 0.1, paintScale.getLowerBound());
    Assert.assertEquals("paintScale default upper bound", 5d, paintScale.getUpperBound());
    Assert.assertEquals("paintScale default paint", Color.WHITE, paintScale.getDefaultPaint());
    Assert.assertEquals("paintScale paint 1", Color.RED, paintScale.getPaint(1));
    Assert.assertEquals("paintScale paint 2", Color.GREEN, paintScale.getPaint(2));
    Assert.assertEquals("paintScale paint 3", Color.BLUE, paintScale.getPaint(3));

    LegendItemCollection legendItems = chart.getXYPlot().getLegendItems();
    Assert.assertEquals("legend item 1 label", "1", legendItems.get(0).getLabel());
    Assert.assertEquals("legend item 1 paint", Color.RED, legendItems.get(0).getFillPaint());
    Assert.assertEquals("legend item 2 label", "2", legendItems.get(1).getLabel());
    Assert.assertEquals("legend item 2 paint", Color.GREEN, legendItems.get(1).getFillPaint());
    Assert.assertEquals("legend item 3 label", "3", legendItems.get(2).getLabel());
    Assert.assertEquals("legend item 3 paint", Color.BLUE, legendItems.get(2).getFillPaint());

    xyzChartDataTest(chart, 0, "serie0",
            new Number[][] { { 1d, 2d, 0d }, { 2d, 3d, 1d }, { 3d, 4d, 2d }, { 4d, 5d, 3d } });

    chart = getChart("summary.chart2", 0);
    Axis axis = chart.getXYPlot().getDomainAxis();
    Assert.assertEquals("category label", "category", axis.getLabel());
    Assert.assertEquals("category label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("category label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());

    chart = getChart("summary.chart3", 0);
    axis = chart.getXYPlot().getRangeAxis();
    Assert.assertEquals("value label", "value", axis.getLabel());
    Assert.assertEquals("value label color", Color.BLUE, axis.getLabelPaint());
    Assert.assertEquals("value label font", new Font("Arial", Font.BOLD, 10), axis.getLabelFont());
    Assert.assertEquals("tick label color", Color.CYAN, axis.getTickLabelPaint());
    Assert.assertEquals("tick label font", new Font("Arial", Font.ITALIC, 10), axis.getTickLabelFont());
    Assert.assertEquals("tick label mask", "10.00", ((NumberAxis) axis).getNumberFormatOverride().format(10));
    Assert.assertEquals("line color", Color.LIGHT_GRAY, axis.getAxisLinePaint());
}

From source file:com.jolbox.benchmark.BenchmarkMain.java

/**
 * @param results//www .  j a va 2 s  .  c o m
 * @param delay 
 * @param statementBenchmark 
 * @param noC3P0 
 */
private static void doPlotLineGraph(long[][] results, int delay, boolean statementBenchmark, boolean noC3P0) {
    XYSeriesCollection dataset = new XYSeriesCollection();
    for (int i = 0; i < ConnectionPoolType.values().length; i++) { //
        if (!ConnectionPoolType.values()[i].isEnabled()
                || (noC3P0 && ConnectionPoolType.values()[i].equals(ConnectionPoolType.C3P0))) {
            continue;
        }
        XYSeries series = new XYSeries(ConnectionPoolType.values()[i].toString());

        for (int j = 1 + BenchmarkTests.stepping; j < results[i].length; j += BenchmarkTests.stepping) {
            series.add(j, results[i][j]);
        }
        dataset.addSeries(series);
    }

    //         Generate the graph
    String title = "Multi-Thread test (" + delay + "ms delay)";
    if (statementBenchmark) {
        title += "\n(with PreparedStatements tests)";
    }
    JFreeChart chart = ChartFactory.createXYLineChart(title, // Title
            "threads", // x-axis Label
            "time (ns)", // y-axis Label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // Plot Orientation
            true, // Show Legend
            true, // Use tooltips
            false // Configure chart to generate URLs?
    );

    XYPlot plot = (XYPlot) chart.getPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);
    plot.setRenderer(renderer);
    renderer.setSeriesPaint(0, Color.BLUE);
    renderer.setSeriesPaint(1, Color.YELLOW);
    renderer.setSeriesPaint(2, Color.BLACK);
    renderer.setSeriesPaint(3, Color.DARK_GRAY);
    renderer.setSeriesPaint(4, Color.MAGENTA);
    renderer.setSeriesPaint(5, Color.RED);
    renderer.setSeriesPaint(6, Color.LIGHT_GRAY);
    //          renderer.setSeriesShapesVisible(1, true);   
    //          renderer.setSeriesShapesVisible(2, true);   

    try {
        String fname = System.getProperty("java.io.tmpdir") + File.separator + "bonecp-multithread-" + delay
                + "ms-delay";
        if (statementBenchmark) {
            fname += "-with-preparedstatements";
        }
        fname += "-poolsize-" + BenchmarkTests.pool_size + "-threads-" + BenchmarkTests.threads;
        if (noC3P0) {
            fname += "-noC3P0";
        }
        fname += ".png";
        ChartUtilities.saveChartAsPNG(new File(fname), chart, 1024, 768);
        System.out.println("******* Saved chart to: " + fname);
    } catch (IOException e) {
        System.err.println("Problem occurred creating chart.");
    }

}

From source file:peakml.util.jfreechart.FastErrorBarPlot.java

@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState,
        PlotRenderingInfo info) {/*from   w w w .j  a v a  2s  .  c  o m*/
    // add the plot area to the info (used amongst other by the axis for zooming)
    if (info != null)
        info.setPlotArea(area);

    // add the insets (if any)
    RectangleInsets insets = getInsets();
    insets.trim(area);

    // draw the axis and add the dataArea to the info (used amongst other by the axis for zooming)
    AxisSpace space = new AxisSpace();
    space = xaxis.reserveSpace(g2, this, area, RectangleEdge.BOTTOM, space);
    space = yaxis.reserveSpace(g2, this, area, RectangleEdge.LEFT, space);

    Rectangle2D dataArea = space.shrink(area, null);
    if (info != null)
        info.setDataArea(dataArea);

    // flood fill the whole area with the background color
    drawBackground(g2, dataArea);

    // draw the axis
    xaxis.draw(g2, dataArea.getMaxY(), area, dataArea, RectangleEdge.BOTTOM, info);
    yaxis.draw(g2, dataArea.getMinX(), area, dataArea, RectangleEdge.LEFT, info);

    // sanity check
    if (dataseries.size() == 0)
        return;

    // clip the draw area
    Shape originalclip = g2.getClip();
    g2.clip(dataArea);

    // create the strokes
    BasicStroke stroke_solid = new BasicStroke(1.f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND, 1.f);
    BasicStroke stroke_dashed = new BasicStroke(1.f, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND, 1.f,
            new float[] { 2, 4 }, 0);

    g2.setStroke(stroke_solid);

    // count the number of labels
    int categoryCount = 0;
    if (showall) {
        for (Data data : dataseries)
            categoryCount += data.yvalues.length;
    } else
        categoryCount = dataseries.size();

    // draw all the values
    int pos = 0;
    boolean dashed = false;
    double prevx = -1, prevy = -1;
    for (Data data : dataseries) {
        if (data.yvalues.length == 0) {
            dashed = true;
            pos++;
            continue;
        }

        double mean[] = showall ? data.yvalues : new double[] { data.getMeanY() };
        double min[] = showall ? data.yvalues : new double[] { data.getMinY() };
        double max[] = showall ? data.yvalues : new double[] { data.getMaxY() };
        for (int i = 0; i < mean.length; ++i) {
            double ypos, xpos = xaxis.getCategoryJava2DCoordinate(CategoryAnchor.MIDDLE, pos++, categoryCount,
                    dataArea, RectangleEdge.BOTTOM);

            // draw the mean value
            g2.setColor(Color.RED);
            ypos = yaxis.valueToJava2D(mean[i], dataArea, RectangleEdge.LEFT);
            g2.drawLine((int) xpos - 2, (int) ypos, (int) xpos + 2, (int) ypos);

            // conect the dots
            if (prevx != -1 && prevy != -1) {
                g2.setColor(Color.BLACK);
                if (dashed)
                    g2.setStroke(stroke_dashed);
                g2.drawLine((int) prevx, (int) prevy, (int) xpos, (int) ypos);
                if (dashed) {
                    dashed = false;
                    g2.setStroke(stroke_solid);
                }

            }
            prevy = ypos;
            prevx = xpos;

            // draw the outer values
            g2.setColor(Color.LIGHT_GRAY);
            double ypos_min = yaxis.valueToJava2D(min[i], dataArea, RectangleEdge.LEFT);
            g2.drawLine((int) xpos - 2, (int) ypos_min, (int) xpos + 2, (int) ypos_min);
            double ypos_max = yaxis.valueToJava2D(max[i], dataArea, RectangleEdge.LEFT);
            g2.drawLine((int) xpos - 2, (int) ypos_max, (int) xpos + 2, (int) ypos_max);
            g2.drawLine((int) xpos, (int) ypos_min, (int) xpos, (int) ypos_max);
        }
    }

    // reset
    g2.setClip(originalclip);
}

From source file:web.diva.server.model.PCAGenerator.java

public PCAImageResult generateChart(String path, PCAResults pcaResults, int[] subSelectionData, int[] selection,
        boolean zoom, boolean selectAll, String imgName, double w, double h, DivaDataset divaDataset) {
    XYDataset dataset = this.createDataset(pcaResults.getPoints(), subSelectionData, selection, zoom,
            divaDataset);/*from  w ww. ja  v a2s.c om*/
    final JFreeChart chart = ChartFactory.createScatterPlot("", // chart title
            "Principal Component" + (pcaResults.getPcai() + 1), // x axis label
            "Principal Component " + (pcaResults.getPcaii() + 1), // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, false, // include legend
            true, // tooltips
            false // urls
    );
    final XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.WHITE);
    plot.setRangeGridlinePaint(Color.WHITE);
    XYDotRenderer renderer = new XYDotRenderer();
    renderer.setDotHeight(5);
    renderer.setDotWidth(5);

    if (selectAll) {
        int i = 0;
        for (String col : seriesList.keySet()) {
            if (col.equalsIgnoreCase("unGrouped")) {
                col = "#000000";
            }
            renderer.setSeriesPaint(i, imgGenerator.hex2Rgb(col));
            i++;
        }

    } else if (selection == null) {
        renderer.setPaint(Color.LIGHT_GRAY);
        int i = 0;
        for (String col : seriesList.keySet()) {
            if (col.equalsIgnoreCase("unGrouped")) {
                col = "#000000";
            }
            renderer.setSeriesPaint(i, imgGenerator.hex2Rgb(col));
            i++;
        }
    } else {
        int i = 0;
        for (String col : seriesList.keySet()) {
            if (col.equalsIgnoreCase("unGrouped")) {
                renderer.setSeriesPaint(i, Color.LIGHT_GRAY);
            } else {
                renderer.setSeriesPaint(i, imgGenerator.hex2Rgb(col));

            }
            i++;
        }
    }
    plot.setRenderer(renderer);
    plot.setSeriesRenderingOrder(SeriesRenderingOrder.REVERSE);
    NumberAxis xAxis = new NumberAxis("Principal Component" + (pcaResults.getPcai() + 1));
    xAxis.setVerticalTickLabels(true);
    boolean auto = xAxis.getAutoRangeIncludesZero();
    xAxis.setAutoRangeIncludesZero(true ^ auto);
    NumberAxis yAxis = new NumberAxis("Principal Component" + (pcaResults.getPcaii() + 1));
    yAxis.setAutoRangeIncludesZero(true ^ auto);
    yAxis.setTickUnit(new NumberTickUnit(1));
    plot.setDomainAxis(0, xAxis);
    plot.setRangeAxis(0, yAxis);

    double MaxX = xAxis.getRange().getUpperBound();
    double MinX = xAxis.getRange().getLowerBound();
    double MaxY = yAxis.getRange().getUpperBound();
    double MinY = yAxis.getRange().getLowerBound();

    chartRenderingInfo.clear();
    String imgUrl = imgGenerator.saveToFile(chart, w, h, path, chartRenderingInfo, imgName);
    PCAImageResult imgUtilRes = new PCAImageResult();
    imgUtilRes.setImgString(imgUrl);
    imgUtilRes.setDataAreaMaxX(chartRenderingInfo.getPlotInfo().getDataArea().getMaxX());
    imgUtilRes.setDataAreaMaxY(chartRenderingInfo.getPlotInfo().getDataArea().getMaxY());
    imgUtilRes.setDataAreaMinY(chartRenderingInfo.getPlotInfo().getDataArea().getMinY());
    imgUtilRes.setDataAreaMinX(chartRenderingInfo.getPlotInfo().getDataArea().getMinX());
    imgUtilRes.setMaxX(MaxX);
    imgUtilRes.setMaxY(MaxY);
    imgUtilRes.setMinX(MinX);
    imgUtilRes.setMinY(MinY);
    return imgUtilRes;
}

From source file:com.itemanalysis.jmetrik.graph.irt.IrtPlotPanel.java

private void createChart(String name, String title, String xLabel, String yLabel, double minScore,
        double maxScore) {
    XYSeriesCollection dataset = new XYSeriesCollection();
    JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title
            xLabel, // x axis label
            yLabel, // y axis label
            dataset, // data
            chartOrientation, // chart orientation
            showLegend, // include legend
            true, // tooltips
            false // urls
    );//  w  w  w  . j  ava 2 s.  c  om

    // get a reference to the plot for further customisation...
    XYPlot plot = (XYPlot) chart.getPlot();
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesFilled(false);
    renderer.setDrawOutlines(true);

    plot.setBackgroundPaint(Color.WHITE);
    plot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    plot.setDomainGridlinePaint(Color.LIGHT_GRAY);

    plot.getDomainAxis().setRange(minScore, maxScore);

    ChartPanel panel = new ChartPanel(chart);
    panel.getPopupMenu().addSeparator();
    panel.setPreferredSize(new Dimension(width, height));

    //        this.addLocalEPSMenuItem(this, panel.getPopupMenu(), chart);//remove this line for public release versions

    chart.setPadding(new RectangleInsets(20.0, 5.0, 20.0, 5.0));
    charts.put(name, chart);

    JPanel subPanel = new JPanel();//additional panel needed to prevent gridlayout from stretching graph
    subPanel.add(panel);
    //        this.addJpgMenuItem(subPanel, panel.getPopupMenu());
    subPanel.setBackground(Color.WHITE);
    this.add(subPanel);

}

From source file:com.planetmayo.debrief.satc_rcp.views.SpatialView.java

/**
 * Creates the Chart based on a dataset// w w  w .j  a  va 2  s .  c  o m
 * 
 * @param _myData2
 */
private JFreeChart createChart(XYDataset _myData2) {
    // tell it to draw joined series
    _renderer = new XYLineAndShapeRenderer(true, false);

    _chart = ChartFactory.createScatterPlot("States", "Lat", "Lon", _myData2, PlotOrientation.HORIZONTAL, true,
            false, false);
    _plot = (XYPlot) _chart.getPlot();
    _plot.setBackgroundPaint(Color.WHITE);
    _plot.setDomainCrosshairPaint(Color.LIGHT_GRAY);
    _plot.setRangeCrosshairPaint(Color.LIGHT_GRAY);
    _plot.setNoDataMessage("No data available");
    _plot.setRenderer(_renderer);
    _chart.getLegend().setVisible(false);

    return _chart;
}

From source file:org.zaproxy.zap.extension.httppanel.view.syntaxhighlight.HttpPanelSyntaxHighlightTextArea.java

protected void highlight(int start, int end) {
    Highlighter hilite = this.getHighlighter();
    HighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(Color.LIGHT_GRAY);

    try {//from w  w  w.j a v  a 2 s . com
        // DOBIN
        removeAllHighlights();
        hilite.addHighlight(start, end, painter);
        this.setCaretPosition(start);
    } catch (BadLocationException e) {
        log.error(e.getMessage(), e);
    }
}

From source file:org.apereo.learninganalytics.snapp.ClusteringDemo.java

private void setUpView(Graph<Integer, Number> grp, Map<Integer, String> name) {
    /*/*from ww w  .j av a  2 s.c o m*/
     Factory<Number> vertexFactory = new Factory<Number>() {
    int n = 0;
    public Number create() { return n++; }
      };
      Factory<Number> edgeFactory = new Factory<Number>()  {
    int n = 0;
    public Number create() { return n++; }
      };
            
      PajekNetReader<Graph<Number, Number>, Number,Number> pnr = 
    new PajekNetReader<Graph<Number, Number>, Number,Number>(vertexFactory, edgeFactory);
              
      final Graph<Number,Number> graph = new SparseMultigraph<Number, Number>();
              
      pnr.load(br, graph);
      */

    //Create a simple layout frame
    //specify the Fruchterman-Rheingold layout algorithm

    this.usernames = name;
    final AggregateLayout<Integer, Number> layout = new AggregateLayout<Integer, Number>(
            new FRLayout<Integer, Number>(grp));
    layout.setSize(new Dimension(500, 500));
    vv = new VisualizationViewer<Integer, Number>(layout);
    vv.setBackground(Color.white);
    //Tell the renderer to use our own customized color rendering
    vv.getRenderContext()
            .setVertexFillPaintTransformer(MapTransformer.<Integer, Paint>getInstance(vertexPaints));
    vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<Integer, Paint>() {
        public Paint transform(Integer v) {
            if (vv.getPickedVertexState().isPicked(v)) {
                return Color.cyan;
            } else {
                return Color.BLACK;
            }
        }
    });

    vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<Number, Paint>getInstance(edgePaints));

    vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Number, Stroke>() {
        protected final Stroke THIN = new BasicStroke(1);
        protected final Stroke THICK = new BasicStroke(2);

        public Stroke transform(Number e) {
            Paint c = edgePaints.get(e);
            if (c == Color.LIGHT_GRAY)
                return THIN;
            else
                return THICK;
        }
    });

    vv.getRenderContext().setVertexLabelTransformer(
            // this chains together Transformers so that the html tags
            // are prepended to the toString method output
            new ChainedTransformer<Integer, String>(
                    new Transformer[] { new ToStringLabeller<String>(), new Transformer<String, String>() {
                        public String transform(String input) {
                            return usernames.get(Integer.parseInt(input));
                        }
                    } }));

    vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.S);
    /*
          //add restart button
          JButton scramble = new JButton("Restart");
          scramble.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent arg0) {
    Layout layout = vv.getGraphLayout();
    layout.initialize();
    Relaxer relaxer = vv.getModel().getRelaxer();
    if(relaxer != null) {
       relaxer.stop();
       relaxer.prerelax();
       relaxer.relax();
    }
             }
            
          });
    */

    DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
    vv.setGraphMouse(gm);

    final JToggleButton groupVertices = new JToggleButton("Group Clusters");

    //Create slider to adjust the number of edges to remove when clustering
    final JSlider edgeBetweennessSlider = new JSlider(JSlider.HORIZONTAL);
    edgeBetweennessSlider.setBackground(Color.WHITE);
    edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50));
    edgeBetweennessSlider.setPaintTicks(true);
    edgeBetweennessSlider.setMaximum(grp.getEdgeCount());
    edgeBetweennessSlider.setMinimum(0);
    edgeBetweennessSlider.setValue(0);
    edgeBetweennessSlider.setMajorTickSpacing(10);
    edgeBetweennessSlider.setPaintLabels(true);
    edgeBetweennessSlider.setPaintTicks(true);

    //      edgeBetweennessSlider.setBorder(BorderFactory.createLineBorder(Color.black));
    //TO DO: edgeBetweennessSlider.add(new JLabel("Node Size (PageRank With Priors):"));
    //I also want the slider value to appear
    final JPanel eastControls = new JPanel();
    eastControls.setOpaque(true);
    eastControls.setLayout(new BoxLayout(eastControls, BoxLayout.Y_AXIS));
    eastControls.add(Box.createVerticalGlue());
    eastControls.add(edgeBetweennessSlider);

    final String COMMANDSTRING = "Edges removed for clusters: ";
    final String eastSize = COMMANDSTRING + edgeBetweennessSlider.getValue();

    final TitledBorder sliderBorder = BorderFactory.createTitledBorder(eastSize);
    eastControls.setBorder(sliderBorder);
    //eastControls.add(eastSize);
    eastControls.add(Box.createVerticalGlue());

    groupVertices.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            clusterAndRecolor(layout, edgeBetweennessSlider.getValue(), similarColors,
                    e.getStateChange() == ItemEvent.SELECTED);
            vv.repaint();
        }
    });

    clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected());

    edgeBetweennessSlider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            JSlider source = (JSlider) e.getSource();
            if (!source.getValueIsAdjusting()) {
                int numEdgesToRemove = source.getValue();
                clusterAndRecolor(layout, numEdgesToRemove, similarColors, groupVertices.isSelected());
                sliderBorder.setTitle(COMMANDSTRING + edgeBetweennessSlider.getValue());
                eastControls.repaint();
                vv.validate();
                vv.repaint();
            }
        }
    });

    // Add a restart button so the graph can be redrawn to fit the size of the frame
    JFrame jf = new JFrame("SNAPP: Find Clusters");
    //jf.getContentPane().add();

    //Container content = getContentPane();
    //content.add(new GraphZoomScrollPane(vv));
    jf.getContentPane().add(new GraphZoomScrollPane(vv));
    JPanel south = new JPanel();
    JPanel grid = new JPanel(new GridLayout(2, 1));
    //grid.add(scramble);
    grid.add(groupVertices);
    south.add(grid);
    south.add(eastControls);
    JPanel p = new JPanel();
    p.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    p.add(gm.getModeComboBox());
    south.add(p);
    //content.add(south, BorderLayout.SOUTH);
    jf.getContentPane().add(south, BorderLayout.SOUTH);

    //jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    jf.pack();
    jf.setVisible(true);
}

From source file:com.jolbox.benchmark.BenchmarkLaunch.java

/**
 * @param results/*from   w  w  w  . j  a  va  2 s . c o  m*/
 * @param delay 
 * @param statementBenchmark 
 * @param noC3P0 
 * @throws IOException 
 */
private static void doPlotLineGraph(long[][] results, int delay, boolean statementBenchmark, boolean noC3P0)
        throws IOException {
    String title = "Multi-Thread test (" + delay + "ms delay)";
    if (statementBenchmark) {
        title += "\n(with PreparedStatements tests)";
    }
    String fname = System.getProperty("java.io.tmpdir") + File.separator + "bonecp-multithread-" + delay
            + "ms-delay";
    if (statementBenchmark) {
        fname += "-with-preparedstatements";
    }
    fname += "-poolsize-" + BenchmarkTests.pool_size + "-threads-" + BenchmarkTests.threads;
    if (noC3P0) {
        fname += "-noC3P0";
    }
    PrintWriter out = new PrintWriter(new FileWriter(fname + ".txt"));
    fname += ".png";

    XYSeriesCollection dataset = new XYSeriesCollection();
    for (int i = 0; i < ConnectionPoolType.values().length; i++) { //
        if (!ConnectionPoolType.values()[i].isEnabled()
                || (noC3P0 && ConnectionPoolType.values()[i].equals(ConnectionPoolType.C3P0))) {
            continue;
        }
        XYSeries series = new XYSeries(ConnectionPoolType.values()[i].toString());
        out.println(ConnectionPoolType.values()[i].toString());
        for (int j = 1 + BenchmarkTests.stepping; j < results[i].length; j += BenchmarkTests.stepping) {
            series.add(j, results[i][j]);
            out.println(j + "," + results[i][j]);
        }
        dataset.addSeries(series);
    }
    out.close();

    //         Generate the graph
    JFreeChart chart = ChartFactory.createXYLineChart(title, // Title
            "threads", // x-axis Label
            "time (ns)", // y-axis Label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // Plot Orientation
            true, // Show Legend
            true, // Use tooltips
            false // Configure chart to generate URLs?
    );

    XYPlot plot = (XYPlot) chart.getPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(true, false);
    plot.setRenderer(renderer);
    renderer.setSeriesPaint(0, Color.BLUE);
    renderer.setSeriesPaint(1, Color.YELLOW);
    renderer.setSeriesPaint(2, Color.BLACK);
    renderer.setSeriesPaint(3, Color.DARK_GRAY);
    renderer.setSeriesPaint(4, Color.MAGENTA);
    renderer.setSeriesPaint(5, Color.RED);
    renderer.setSeriesPaint(6, Color.LIGHT_GRAY);
    //          renderer.setSeriesShapesVisible(1, true);   
    //          renderer.setSeriesShapesVisible(2, true);   

    try {
        ChartUtilities.saveChartAsPNG(new File(fname), chart, 1024, 768);
        System.out.println("******* Saved chart to: " + fname);
    } catch (IOException e) {
        System.err.println("Problem occurred creating chart.");
    }

}

From source file:org.jrecruiter.web.actions.admin.ShowStatisticsAction.java

public final String chartJobCount() throws Exception {

    final Calendar calendarToday = CalendarUtils.getCalendarWithoutTime();

    final Calendar calendar30 = CalendarUtils.getCalendarWithoutTime();
    calendar30.add(Calendar.MONTH, -36);

    final List<JobCountPerDay> jobCountPerDayList = jobService.getJobCountPerDayAndPeriod(calendar30.getTime(),
            calendarToday.getTime());/*from  w  ww . ja v a2s .c o  m*/

    final TimeSeries hitsPerDayData = new TimeSeries("Hits", Day.class);
    final XYDataset hitsPerDayDataset = new TimeSeriesCollection(hitsPerDayData);
    this.chart = ChartFactory.createTimeSeriesChart("",
            super.getText("class.ShowStatisticsAcion.chart.job.count.caption"), "", hitsPerDayDataset, false,
            true, false);

    final XYPlot xyplot = (XYPlot) this.chart.getPlot();

    for (JobCountPerDay jobCountPerDay : jobCountPerDayList) {

        final Day day = new Day(jobCountPerDay.getJobDate());

        if (jobCountPerDay.getAutomaticallyCleaned()) {

            final Marker originalEnd = new ValueMarker(day.getFirstMillisecond());
            originalEnd.setPaint(new Color(0, 80, 138, 150));
            float[] dashPattern = { 6, 2 };

            originalEnd.setStroke(
                    new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10, dashPattern, 0));
            originalEnd.setLabelAnchor(RectangleAnchor.TOP_LEFT);
            originalEnd.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
            originalEnd.setLabel("C");
            originalEnd.setAlpha(0.1F);
            xyplot.addDomainMarker(originalEnd);
        }

        hitsPerDayData.add(day, jobCountPerDay.getTotalNumberOfJobs());
    }

    chart.setBackgroundPaint(new Color(255, 255, 255, 0));

    xyplot.setDomainGridlinePaint(Color.LIGHT_GRAY);
    xyplot.setBackgroundPaint(new Color(255, 255, 255, 0));

    xyplot.setRangeGridlinePaint(Color.LIGHT_GRAY);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    xyplot.setDomainCrosshairVisible(true);
    xyplot.setRangeCrosshairVisible(true);

    org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer();
    if (xyitemrenderer instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer;
        xylineandshaperenderer.setBaseShapesVisible(false);
        xyitemrenderer.setSeriesPaint(0, new Color(244, 66, 0));
    }

    DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();

    dateaxis.setAutoRange(true);
    dateaxis.setAutoTickUnitSelection(true);

    NumberAxis valueAxis = (NumberAxis) xyplot.getRangeAxis();
    valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    return SUCCESS;
}