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.floreantpos.swing.BarTabButton.java

public void update() {
    setEnabled(true);
    setBackground(Color.white);
    setForeground(Color.black);
}

From source file:ws.moor.bt.gui.charts.TotalBlocksPerPeer.java

private JFreeChart createChart() {

    JFreeChart chart = ChartFactory.createStackedBarChart("Top 20 Block Peers", "Remote IP", "Blocks",
            createDataset(), PlotOrientation.VERTICAL, true, false, false);
    chart.setBackgroundPaint(Color.white);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 2.0));

    return chart;
}

From source file:PerformanceGraph.java

/**
 * Plots the performance graph of the best fitness value so far versus the
 * number of function calls (NFC)./*  w w  w.  j a v a 2  s.c  o  m*/
 * 
 * @param bestFitness A linked hashmap mapping the NFC to the best fitness value
 * found so far.
 * @param fitnessFunction The name of the fitness function, used for the title and the
 * name of the file that is saved, e.g. "De Jong".
 */
public static void plot(LinkedHashMap<Integer, Double> bestFitness, String fitnessFunction) {
    /* Create an XYSeries plot */
    XYSeries series = new XYSeries("Best Fitness Value Vs. Number of Function Calls");

    /* Add the NFC and best fitness value data to the series */
    for (Integer NFC : bestFitness.keySet()) {
        /* Jfreechart crashes if double values are too large! */
        if (bestFitness.get(NFC) <= 10E12) {
            series.add(NFC.doubleValue(), bestFitness.get(NFC).doubleValue());
        }
    }

    /* Add the x,y series data to the dataset */
    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);

    /* Plot the data as an X,Y line chart */
    JFreeChart chart = ChartFactory.createXYLineChart("Best Fitness Value Vs. Number of Function Calls",
            "Number of Function Calls (NFC)", "Best Fitness Value", dataset, PlotOrientation.VERTICAL, false,
            true, false);

    /* Configure the chart settings such as anti-aliasing, background colour */
    chart.setAntiAlias(true);

    XYPlot plot = chart.getXYPlot();

    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.black);
    plot.setDomainGridlinePaint(Color.black);

    /* Set the domain range from 0 to NFC */
    NumberAxis domain = (NumberAxis) plot.getDomainAxis();
    domain.setRange(0.0, ControlVariables.MAX_FUNCTION_CALLS.doubleValue());

    /* Logarithmic range axis */
    plot.setRangeAxis(new LogAxis());

    /* Set the thickness and colour of the lines */
    XYItemRenderer renderer = plot.getRenderer();
    BasicStroke thickLine = new BasicStroke(3.0f);
    renderer.setSeriesStroke(0, thickLine);
    renderer.setPaint(Color.BLACK);

    /* Display the plot in a JFrame */
    ChartFrame frame = new ChartFrame(fitnessFunction + " Best Fitness Value", chart);
    frame.setVisible(true);
    frame.setSize(1000, 600);

    /* Save the plot as an image named after fitness function
    try
    {
       ChartUtilities.saveChartAsJPEG(new File("plots/" + fitnessFunction + ".jpg"), chart, 1600, 900);
    }
    catch (IOException e)
    {
       e.printStackTrace();
    }*/
}

From source file:gui.statistic.JChartPanel.java

protected static JFreeChart createChart() {
    categoryDataset = new DefaultCategoryDataset();
    //categoryDataset.addValue(20, "", "A");
    //categoryDataset.addValue(35, "", "A");
    //categoryDataset.addValue(40, "", "B");
    //categoryDataset.addValue(60, "", "B");

    JFreeChart chart = ChartFactory.createBarChart("", // Title
            "Belegungen", // X-Axis label
            "Werte", // Y-Axis label
            categoryDataset, // Dataset
            PlotOrientation.VERTICAL, false, true, false // Show legend
    );//from  w  w  w. j  a v a2s .c o  m

    chart.setBackgroundPaint(Color.WHITE);

    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setBackgroundPaint(Color.LIGHT_GRAY);
    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);

    return chart;

}

From source file:include.picture.MyPieChart.java

public void paint() {
    try {/*from   w  ww . j ava  2  s  .  com*/
        check();
        DefaultPieDataset dataset = getDataSet(item, quantity);
        JFreeChart chart = ChartFactory.createPie3DChart(title, dataset, true, // ?
                false, false);
        chart.setBackgroundPaint(Color.WHITE);
        Pie3DPlot plot = (Pie3DPlot) chart.getPlot();
        plot.setSectionLabelType(PiePlot.PERCENT_LABELS);
        plot.setPercentFormatString("#,###0.00%");
        //Pie3DPlotsetDepthFactor ?
        plot.setDepthFactor(0.05);
        FileOutputStream fos_jpg = null;
        try {
            fos_jpg = new FileOutputStream(fileName);
            ChartUtilities.writeChartAsJPEG(fos_jpg, 1000, chart, width, height, null);
        } finally {
            try {
                fos_jpg.close();
            } catch (Exception e) {
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.jfree.chart.demo.XYDrawableAnnotationDemo1.java

private static JFreeChart createChart(XYDataset xydataset) {
    JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("XYDrawableAnnotationDemo1", null, "$ million",
            xydataset, true, true, false);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    xyplot.setDomainPannable(true);/*from  w  w  w. j ava 2s.c o m*/
    xyplot.setRangePannable(true);
    DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis();
    dateaxis.setLowerMargin(0.20000000000000001D);
    dateaxis.setUpperMargin(0.20000000000000001D);
    dateaxis.setStandardTickUnits(createStandardDateTickUnits());
    NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis();
    numberaxis.setLowerMargin(0.20000000000000001D);
    numberaxis.setUpperMargin(0.20000000000000001D);
    XYLineAndShapeRenderer xylineandshaperenderer = new XYLineAndShapeRenderer();
    xylineandshaperenderer.setBaseShapesVisible(true);
    xylineandshaperenderer.setBaseLinesVisible(true);
    xylineandshaperenderer.setSeriesShape(0, new java.awt.geom.Ellipse2D.Double(-5D, -5D, 10D, 10D));
    xylineandshaperenderer.setSeriesShape(1, new java.awt.geom.Ellipse2D.Double(-5D, -5D, 10D, 10D));
    xylineandshaperenderer.setSeriesStroke(0, new BasicStroke(3F));
    xylineandshaperenderer.setSeriesStroke(1, new BasicStroke(3F, 1, 1, 5F, new float[] { 10F, 5F }, 0.0F));
    xylineandshaperenderer.setSeriesFillPaint(0, Color.white);
    xylineandshaperenderer.setSeriesFillPaint(1, Color.white);
    xylineandshaperenderer.setUseFillPaint(true);
    xylineandshaperenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    xylineandshaperenderer.setDefaultEntityRadius(6);
    xylineandshaperenderer.addAnnotation(new XYDrawableAnnotation((new Month(4, 2005)).getFirstMillisecond(),
            600D, 180D, 100D, 3D, createPieChart()));
    xylineandshaperenderer.addAnnotation(new XYDrawableAnnotation((new Month(9, 2007)).getFirstMillisecond(),
            1250D, 120D, 100D, 2D, createBarChart()));
    xyplot.setRenderer(xylineandshaperenderer);
    return jfreechart;
}

From source file:RasterDemo.java

RasterPanel() {
    setBackground(Color.white);
    setSize(450, 400);/*from   w  ww. j  a va 2  s.  c  o  m*/

    Image image = getToolkit().getImage("largeJava2sLogo.jpg");

    MediaTracker mt = new MediaTracker(this);
    mt.addImage(image, 1);
    try {
        mt.waitForAll();
    } catch (Exception e) {
        System.out.println("Exception while loading image.");
    }

    if (image.getWidth(this) == -1) {
        System.out.println("No jpg file");
        System.exit(0);
    }

    bi1 = new BufferedImage(image.getWidth(this), image.getHeight(this), BufferedImage.TYPE_INT_ARGB);
    Graphics2D big = bi1.createGraphics();
    big.drawImage(image, 0, 0, this);
    bi = bi1;
}

From source file:ColorChooserMenu.java

public ColorMenu(String name) {
    super(name);//  ww  w .  j a  v  a 2  s. c  om
    unselectedBorder = new CompoundBorder(new MatteBorder(1, 1, 1, 1, getBackground()),
            new BevelBorder(BevelBorder.LOWERED, Color.white, Color.gray));
    selectedBorder = new CompoundBorder(new MatteBorder(1, 1, 1, 1, Color.red),
            new MatteBorder(1, 1, 1, 1, getBackground()));
    activeBorder = new CompoundBorder(new MatteBorder(1, 1, 1, 1, Color.blue),
            new MatteBorder(1, 1, 1, 1, getBackground()));

    JPanel p = new JPanel();
    p.setBorder(new EmptyBorder(5, 5, 5, 5));
    p.setLayout(new GridLayout(8, 8));
    paneTable = new Hashtable();

    int[] values = new int[] { 0, 128, 192, 255 };

    for (int r = 0; r < values.length; r++) {
        for (int g = 0; g < values.length; g++) {
            for (int b = 0; b < values.length; b++) {
                Color c = new Color(values[r], values[g], values[b]);
                ColorPane pn = new ColorPane(c);
                p.add(pn);
                paneTable.put(c, pn);
            }
        }
    }
    add(p);
}

From source file:edu.emory.library.tast.database.graphs.GraphTypeScatter.java

public JFreeChart createChart(Object[] data) {

    CategoryTableXYDataset dataset = new CategoryTableXYDataset();

    JFreeChart chart = ChartFactory.createScatterPlot(null, getSelectedIndependentVariable().getLabel(),
            TastResource.getText("components_charts_barvalue"), dataset, PlotOrientation.VERTICAL, true, true,
            false);/*from   w w  w.  j av a2s .c  o  m*/

    //getSelectedIndependentVariable().getFormat();

    XYPlot plot = chart.getXYPlot();
    ((NumberAxis) plot.getDomainAxis()).setNumberFormatOverride(new DecimalFormat("0"));

    chart.setBackgroundPaint(Color.white);

    List allDataSeries = getDataSeries();
    for (int j = 0; j < allDataSeries.size(); j++) {
        DataSeries dataSearies = (DataSeries) allDataSeries.get(j);
        String dataSeriesLabel = dataSearies.formatForDisplay();
        for (int i = 0; i < data.length; i++) {
            Object[] row = (Object[]) data[i];
            Number x = (Number) row[0];
            Number y = (Number) row[j + 1];
            if (x != null && y != null)
                dataset.add(x.doubleValue(), y.doubleValue(), dataSeriesLabel);
        }
    }

    return chart;

}

From source file:org.openmrs.module.tracpatienttransfer.web.view.chart.AbstractChartView.java

/**
 * @see org.springframework.web.servlet.view.AbstractView
 *//*from  w w w .j a va2s.  c o  m*/
@Override
@SuppressWarnings("unchecked")
protected void renderMergedOutputModel(Map model, HttpServletRequest request, HttpServletResponse response)
        throws Exception {
    // Respond as a PNG image
    response.setContentType("image/png");

    // Disable caching
    response.setHeader("Pragma", "No-cache");
    response.setDateHeader("Expires", 0);
    response.setHeader("Cache-Control", "no-cache");

    int width = Integer.valueOf(request.getParameter("width"));
    int height = Integer.valueOf(request.getParameter("height"));
    ;

    JFreeChart chart = createChart(model, request);
    chart.setBackgroundPaint(Color.WHITE);
    chart.getPlot().setOutlineStroke(new BasicStroke(0));
    chart.getPlot().setOutlinePaint(getBackgroundColor());
    chart.getPlot().setBackgroundPaint(getBackgroundColor());
    chart.getPlot().setNoDataMessage(
            TransferOutInPatientUtil.getMessage("tracpatienttransfer.error.noDataAvailable", null));

    ChartUtilities.writeChartAsPNG(response.getOutputStream(), chart, width, height);
}