Example usage for java.awt Color WHITE

List of usage examples for java.awt Color WHITE

Introduction

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

Prototype

Color WHITE

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

Click Source Link

Document

The color white.

Usage

From source file:com.wattzap.view.graphs.GenericScatterGraph.java

public GenericScatterGraph(XYSeries series, String xAxis, String yAxis) {
    super();/*from ww  w. j  a va  2s  . com*/

    XYDataset xyDataset = new XYSeriesCollection(series);

    JFreeChart chart = ChartFactory.createScatterPlot("", // chart title
            xAxis, // x axis label
            yAxis, // y axis label
            null, PlotOrientation.VERTICAL, false, // include legend
            true, // tooltips
            false // urls
    );

    chart.setBackgroundPaint(Color.darkGray);
    plot = chart.getXYPlot();
    plot.setDataset(0, xyDataset);
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);

    // Shape cross = ShapeUtilities.createDiamond(0.5f);
    Shape cross = ShapeUtilities.createDiagonalCross(0.5f, 0.5f);
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, new Color(252, 141, 89));
    renderer.setSeriesShape(0, cross);

    ValueAxis domainAxis = plot.getDomainAxis();
    domainAxis.setTickLabelPaint(Color.white);
    domainAxis.setLabelPaint(Color.white);

    ValueAxis rangeAxis = plot.getRangeAxis();
    rangeAxis.setTickLabelPaint(Color.white);
    rangeAxis.setLabelPaint(Color.white);

    chartPanel = new ChartPanel(chart);
    chartPanel.setSize(100, 800);

    setLayout(new BorderLayout());
    add(chartPanel, BorderLayout.CENTER);
    setBackground(Color.black);

    chartPanel.revalidate();
    setVisible(true);
}

From source file:SimpleAttributes.java

public void paintComponent(Graphics g) {
    Graphics2D g2d = (Graphics2D) g.create();
    g2d.setBackground(Color.GRAY);
    g2d.clearRect(0, 0, getWidth(), getHeight());

    // String and line with default attributes
    g2d.drawString("Default Font", 10, 20);
    g2d.drawLine(10, 22, 80, 22);// w  w w .jav  a2 s. co m

    // Change the font, foreground color, and Stroke
    g2d.setFont(g.getFont().deriveFont(Font.BOLD | Font.ITALIC, 24f));
    g2d.setColor(Color.WHITE);
    g2d.setStroke(new BasicStroke(10f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER));

    // String and line with new attributes
    g2d.drawString("New Font", 10, 50);
    g2d.drawLine(10, 57, 120, 57);
    g2d.dispose();
}

From source file:com.compomics.pepshell.view.statistics.JFreeChartPanel.java

private static void setupPlot(XYPlot xYPlot) {
    // set background to white and grid color to black
    xYPlot.setBackgroundPaint(Color.white);
    xYPlot.setRangeGridlinePaint(Color.black);
    // hide the border of the sorrounding box
    xYPlot.setOutlinePaint(Color.white);
    // get domanin and range axes
    ValueAxis domainAxis = xYPlot.getDomainAxis();
    ValueAxis rangeAxis = xYPlot.getRangeAxis();
    // set label paint for axes to black
    domainAxis.setLabelPaint(Color.black);
    rangeAxis.setLabelPaint(Color.black);
    // set font for labels, both on domain and range axes
    domainAxis.setLabelFont(new Font("Tahoma", Font.BOLD, 12));
    rangeAxis.setLabelFont(new Font("Tahoma", Font.BOLD, 12));
}

From source file:cheuk.licenseheaderchecker.resource.DataGraph.java

/**
* Creates a trend graph//from  w w  w . j a va  2  s .  c  o m
*
* @return the JFreeChart graph object
*/
protected JFreeChart createGraph() {

    final JFreeChart chart = ChartFactory.createLineChart(null, // chart title
            null, // unused
            yLabel, // range axis label
            categoryDataset, // data
            PlotOrientation.VERTICAL, // orientation
            false, // include legend
            true, // tooltips
            false // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    //final LegendTitle legend = chart.getLegend();
    //legend.setPosition(RectangleEdge.RIGHT);

    chart.setBackgroundPaint(Color.white);

    final CategoryPlot plot = chart.getCategoryPlot();

    // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.black);

    CategoryAxis domainAxis = new ShiftedCategoryAxis(null);
    plot.setDomainAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.setCategoryMargin(0.0);

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setLowerBound(0);
    //        rangeAxis.setAutoRange(true);

    final StackedAreaRenderer renderer = new StackedAreaRenderer2();
    plot.setRenderer(renderer);
    //renderer.setBaseStroke(new BasicStroke(2.0f));
    //ColorPalette.apply(renderer);
    plot.setRenderer(renderer);
    renderer.setSeriesPaint(2, RED);
    renderer.setSeriesPaint(1, GRAY);
    renderer.setSeriesPaint(0, YELLOW);

    // crop extra space around the graph
    plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0));

    return chart;
}

From source file:com.waitwha.nessus.trendanalyzer.gui.TimeChartPanel.java

/**
 * Constructor/*from   www . j a  va2 s  .c  o  m*/
 *
 * @param title            String title of the chart.
 * @param xaxisLabel   String x-axis label of the chart.
 * @param yaxisLabel   String y-axis label of the chart (time).
 * @param dataset         XYDataset to use within the chart.
 */
public TimeChartPanel(String title, String xaxisLabel, String yaxisLabel, XYDataset dataset) {
    super(new BorderLayout());
    JFreeChart chart = ChartFactory.createTimeSeriesChart(title, xaxisLabel, yaxisLabel, dataset, true, // create legend?
            true, // generate tooltips?
            false // generate URLs?
    );

    chart.setBackgroundPaint(Color.white);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    XYItemRenderer r = plot.getRenderer();
    if (r instanceof XYLineAndShapeRenderer) {
        XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) r;
        renderer.setBaseShapesVisible(true);
        renderer.setBaseShapesFilled(true);
        renderer.setDrawSeriesLineAsPath(true);
    }

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd HH:mm"));

    ChartPanel panel = new ChartPanel(chart);
    panel.setMouseWheelEnabled(true);
    this.add(panel, BorderLayout.CENTER);
    this.validate();
}

From source file:edu.psu.citeseerx.misc.charts.CiteChartBuilderJFree.java

protected JFreeChart buildChart(Document doc) throws SQLException {

    Long clusterid = doc.getClusterID();
    if (clusterid == null) {
        return null;
    }//from w w  w .j a v a 2s.  com

    java.util.List<ThinDoc> citingDocs = citedao.getCitingDocuments(clusterid, 0, MAX_CITING);
    XYDataset dataset = collectData(citingDocs);
    if (dataset.getItemCount(0) <= 1) {
        return null;
    }

    XYBarDataset ivl_dataset = new XYBarDataset(dataset, 15.0);
    JFreeChart chart = ChartFactory.createXYBarChart(null, "Year", true, "Citation Count", ivl_dataset,
            PlotOrientation.VERTICAL, false, false, false);
    chart.setBackgroundPaint(Color.WHITE);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.WHITE);
    plot.setRangeGridlinePaint(Color.WHITE);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);

    XYItemRenderer r = plot.getRenderer();

    NumberAxis axis = (NumberAxis) plot.getDomainAxis();
    axis.setNumberFormatOverride(NumberFormat.getIntegerInstance());
    //axis.setTickUnit(new DateTickUnit(DateTickUnit.YEAR, -1));
    //axis.setDateFormatOverride(new SimpleDateFormat("yyyy"));
    return chart;

}

From source file:gui.Plotter1D.java

private ChartPanel createChartPanel1(String grapheName) {

    XYSplineRenderer xysplinerenderer = new XYSplineRenderer();
    ValueAxis valueAxis = new NumberAxis("X");
    valueAxis.setRange(0.0, 1.0);// ww w  .  jav a2s. c om
    ValueAxis valueAxisy = new NumberAxis("Y");
    valueAxis.setRange(0.0, 1.0);
    XYPlot xyplot;
    xyplot = new XYPlot(xyseriescollection, valueAxis, valueAxisy, xysplinerenderer);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(4D, 4D, 4D, 4D));
    JFreeChart jfreechart = new JFreeChart(grapheName, JFreeChart.DEFAULT_TITLE_FONT, xyplot, true);
    jfreechart.setBackgroundPaint(Color.white);
    ChartPanel chartpanel = new ChartPanel(jfreechart, false);
    return chartpanel;
}

From source file:DrawingApplet.java

public void init() {
    // Find out how big the applet is and create an offscreen image
    // that size.
    int w = getWidth();
    int h = getHeight();
    image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
    // Get a graphics context for drawing into the image
    g = image.createGraphics();/*from   w ww .j a  v  a  2  s  . c o m*/
    // Start with a pure white background
    g.setPaint(Color.WHITE);
    g.fillRect(0, 0, w, h);
    // Turn on antialiasing
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    try {
        // sleep here to simulate a long init method
        Thread.sleep(4000);
    } catch (InterruptedException ie) {
        ie.printStackTrace();
    }
}

From source file:edu.ucla.stat.SOCR.chart.SuperCategoryChart_Bar3D.java

protected JFreeChart createLegend(CategoryDataset dataset) {

    //  JFreeChart chart = ChartFactory.createAreaChart(
    JFreeChart chart = ChartFactory.createBarChart3D(chartTitle, // chart title
            "Category", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
    );/* www .j  a  va2s .c  o m*/

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);
    CategoryPlot plot = chart.getCategoryPlot();

    BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer();
    // renderer.setDrawOutlines(true);
    // renderer.setUseFillPaint(true);
    // renderer.setFillPaint(Color.white);
    renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());
    return chart;

}

From source file:SystemAnomalies.bouncedLogInRate.java

public ChartPanel getChartPanel() {
    XYSeries series = new XYSeries("Annual Composite Production Vs Farmers Experience");
    series.add(0, 0);//from  w  w w .j  a v a 2s  .c o  m
    series.add(1, 100);
    series.add(2, 100);
    series.add(3, 100);
    series.add(4, 120);
    series.add(5, 120);
    series.add(6, 1040);
    series.add(7, 1040);
    series.add(8, 1040);
    series.add(9, 2000);
    series.add(10, 2000);
    series.add(11, 100);
    series.add(12, 100);
    series.add(13, 100);
    series.add(14, 120);
    series.add(15, 120);
    series.add(16, 1040);
    series.add(17, 1040);
    series.add(18, 1040);
    series.add(19, 2000);
    series.add(20, 2000);
    series.add(21, 1845);
    series.add(22, 1040);
    series.add(23, 2000);

    // Add the series to your data set
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);
    // Generate the graph
    JFreeChart chart = ChartFactory.createXYLineChart("Sign-in Bounce off Rate", // Title
            "Time of Day", // x-axis Label
            "Number of Attempts", // y-axis Label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // Plot Orientation
            true, // Show Legend
            true, // Use tooltips
            false // Configure chart to generate URLs?
    );

    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setBackground(Color.WHITE);
    chartPanel.setBounds(2, 5, 750, 500);
    chartPanel.setBorder(new LineBorder(Color.decode("#f5f5f5"), 2));

    return chartPanel;
}