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:org.mwc.cmap.grideditor.chart.ChartBuilder.java

public JFreeChart buildChart() {
    final ValueAxis xAxis = myManager.createXAxis();
    final ValueAxis yAxis = myManager.createYAxis();
    final XYDataset data = myManager.getXYDataSet();
    final XYLineAndShapeRenderer renderer = new ColorRenderer();
    final XYPlot xyplot = new XYPlot(data, xAxis, yAxis, renderer);
    xyplot.setOrientation(PlotOrientation.HORIZONTAL);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5, 5, 5, 5));
    final JFreeChart result = new JFreeChart(myManager.getChartTitle(), JFreeChart.DEFAULT_TITLE_FONT, xyplot,
            false);/*from  www  .  j a va  2  s . co m*/
    ChartUtilities.applyCurrentTheme(result);
    return result;
}

From source file:com.mergano.core.AreaChart.java

private JFreeChart createChart(final CategoryDataset dataset) {

    final JFreeChart chart = ChartFactory.createAreaChart("Order statistic", // chart title
            "Days", // domain axis label
            "Order Average", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            false, // tooltips
            false // urls
    );//  w w w.  j  a va 2  s  . c o m

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    // set the background color for the chart...
    //        final StandardLegend legend = (StandardLegend) chart.getLegend();
    //      legend.setAnchor(StandardLegend.SOUTH);
    chart.setBackgroundPaint(Color.white);
    chart.setAntiAlias(true);

    CategoryPlot plot = chart.getCategoryPlot();
    plot.getRenderer().setSeriesPaint(0, new Color(0, 191, 165));
    plot.setForegroundAlpha(0.75f);
    plot.setBackgroundPaint(Color.white);

    plot.setDomainCrosshairVisible(false);
    plot.setRangeCrosshairVisible(false);
    // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); // disable this
    plot.setDomainGridlinesVisible(false);
    plot.setDomainGridlinePaint(new Color(240, 240, 240));
    plot.setRangeGridlinesVisible(false);
    plot.setRangeGridlinePaint(new Color(240, 240, 240));
    plot.setDomainCrosshairPaint(Color.MAGENTA);
    plot.setRangeCrosshairPaint(Color.CYAN);

    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.addCategoryLabelToolTip("Type 1", "The first type.");
    domainAxis.addCategoryLabelToolTip("Type 2", "The second type.");
    domainAxis.addCategoryLabelToolTip("Type 3", "The third type.");

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setLabelAngle(0 * Math.PI / 2.0);
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:io.sanfran.wikiTrends.extraction.plots.PlotTimeSeries.java

private static JFreeChart createChart(XYDataset dataset, String title) {

    JFreeChart chart = ChartFactory.createTimeSeriesChart(title, // title
            "Date", // x-axis label
            "Page visits", // y-axis label
            dataset, // data
            true, // create legend?
            true, // generate tooltips?
            false // generate URLs?
    );//from w  ww . ja  va  2s  .  c  om

    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(false); // if you want visible dots -> true
        renderer.setBaseShapesFilled(false); // if you want visible dots -> true

        if (seriesWidth != null) {
            for (int i = 0; i < seriesWidth.size(); i++) {
                renderer.setSeriesStroke(i, new BasicStroke(seriesWidth.get(i)));
            }
        }
        if (seriesColor != null) {
            for (int i = 0; i < seriesColor.size(); i++) {
                renderer.setSeriesPaint(i, seriesColor.get(i));
            }
        }

    }

    DateAxis axis = (DateAxis) plot.getDomainAxis();
    //axis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy"));
    axis.setDateFormatOverride(new SimpleDateFormat("dd-MM-yyyy"));

    return chart;

}

From source file:com.kiyoshi.gui.AreaChart.java

private JFreeChart createChart(final CategoryDataset dataset) {

    final JFreeChart chart = ChartFactory.createAreaChart("Area Chart", // chart title
            "Category", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
    );//ww  w.  ja  va 2s  .  co m

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    // set the background color for the chart...
    //        final StandardLegend legend = (StandardLegend) chart.getLegend();
    //      legend.setAnchor(StandardLegend.SOUTH);
    chart.setBackgroundPaint(Color.white);
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setForegroundAlpha(0.5f);

    //      plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);

    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.addCategoryLabelToolTip("Type 1", "The first type.");
    domainAxis.addCategoryLabelToolTip("Type 2", "The second type.");
    domainAxis.addCategoryLabelToolTip("Type 3", "The third type.");

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setLabelAngle(0 * Math.PI / 2.0);
    // OPTIONAL CUSTOMISATION COMPLETED.

    return chart;

}

From source file:costumetrade.common.verify.ImageVerification.java

public Pair<String, BufferedImage> create() {
    int x = 0, fontHeight = 0, codeY = 0;
    int red = 0, green = 0, blue = 0;

    x = width / (codeCount + 2);//?
    fontHeight = height - 2;//
    codeY = height - 4;/*  w  w w . j  a  va  2  s  .  com*/

    // ?buffer
    BufferedImage buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = buffImg.createGraphics();
    // ?
    g.setColor(Color.WHITE);
    g.fillRect(0, 0, width, height);
    // 
    g.setFont(new Font("Arial", Font.PLAIN, fontHeight));

    for (int i = 0; i < lineCount; i++) {

        int xs = RandomUtils.nextInt(0, width);
        int ys = RandomUtils.nextInt(0, height);
        int xe = xs + RandomUtils.nextInt(0, width / 8);
        int ye = ys + RandomUtils.nextInt(0, height / 8);
        red = RandomUtils.nextInt(0, 255);
        green = RandomUtils.nextInt(0, 255);
        blue = RandomUtils.nextInt(0, 255);
        g.setColor(new Color(red, green, blue));
        g.drawLine(xs, ys, xe, ye);
    }

    // randomCode???
    StringBuilder randomCode = new StringBuilder();
    // ?codeCount??
    for (int i = 0; i < codeCount; i++) {
        String strRand = String.valueOf(codeSequence[RandomUtils.nextInt(0, codeSequence.length)]);
        // ????
        red = RandomUtils.nextInt(0, 255);
        green = RandomUtils.nextInt(0, 255);
        blue = RandomUtils.nextInt(0, 255);
        g.setColor(new Color(red, green, blue));
        g.drawString(strRand, (i + 1) * x, codeY);
        // ??
        randomCode.append(strRand);
    }
    // ????Session
    return new Pair<String, BufferedImage>(randomCode.toString(), buffImg);
}

From source file:pl.poid.bzdp.zadanieObrazy.ImageHistogram.java

private JFreeChart createChart(final XYSeriesCollection dataset, Color c) {

    final JFreeChart chart = ChartFactory.createXYBarChart("Histogram", "Brightness", false, "Values", dataset,
            PlotOrientation.VERTICAL, true, true, false);

    XYItemRenderer renderer = chart.getXYPlot().getRenderer();
    renderer.setSeriesPaint(0, c);// w  w  w  .  jav  a 2s .  c  o m
    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    return chart;

}

From source file:aka.pirana.jdoc.JChart.java

private JPanel createChartPanel() {
    NumberAxis numberaxis = new NumberAxis("Date");
    numberaxis.setAutoRangeIncludesZero(false);
    NumberAxis numberaxis1 = new NumberAxis("%");
    numberaxis1.setAutoRangeIncludesZero(false);
    XYSplineRenderer xysplinerenderer = new XYSplineRenderer();
    XYPlot xyplot = new XYPlot(SampleGenerator(), numberaxis, numberaxis1, 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("JDocSplineRenderer", JFreeChart.DEFAULT_TITLE_FONT, xyplot, true);
    ChartUtilities.applyCurrentTheme(jfreechart);
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    return chartpanel;
}

From source file:org.jfree.chart.swt.demo.SWTMultipleAxisDemo1.java

/**
 * Creates the demo chart./*w w  w .  j a v a2  s  .co m*/
 *
 * @return The chart.
 */
private static JFreeChart createChart() {

    XYDataset dataset1 = createDataset("Series 1", 100.0, new Minute(), 200);

    JFreeChart chart = ChartFactory.createTimeSeriesChart("Multiple Axis Demo 3", "Time of Day",
            "Primary Range Axis", dataset1, true, true, false);

    chart.setBackgroundPaint(Color.white);
    chart.setBorderVisible(true);
    chart.setBorderPaint(Color.BLACK);
    TextTitle subtitle = new TextTitle("Four datasets and four range axes.");
    chart.addSubtitle(subtitle);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setOrientation(PlotOrientation.VERTICAL);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.black);

    // AXIS 2
    NumberAxis axis2 = new NumberAxis("Range Axis 2");
    axis2.setAutoRangeIncludesZero(false);
    axis2.setLabelPaint(Color.red);
    axis2.setTickLabelPaint(Color.red);
    plot.setRangeAxis(1, axis2);
    plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_LEFT);

    XYDataset dataset2 = createDataset("Series 2", 1000.0, new Minute(), 170);
    plot.setDataset(1, dataset2);
    plot.mapDatasetToRangeAxis(1, 1);
    XYItemRenderer renderer2 = new StandardXYItemRenderer();
    renderer2.setSeriesPaint(0, Color.red);
    plot.setRenderer(1, renderer2);

    // AXIS 3
    NumberAxis axis3 = new NumberAxis("Range Axis 3");
    axis3.setLabelPaint(Color.blue);
    axis3.setTickLabelPaint(Color.blue);
    //axis3.setPositiveArrowVisible(true);
    plot.setRangeAxis(2, axis3);

    XYDataset dataset3 = createDataset("Series 3", 10000.0, new Minute(), 170);
    plot.setDataset(2, dataset3);
    plot.mapDatasetToRangeAxis(2, 2);
    XYItemRenderer renderer3 = new StandardXYItemRenderer();
    renderer3.setSeriesPaint(0, Color.blue);
    plot.setRenderer(2, renderer3);

    // AXIS 4
    NumberAxis axis4 = new NumberAxis("Range Axis 4");
    axis4.setLabelPaint(Color.green);
    axis4.setTickLabelPaint(Color.green);
    plot.setRangeAxis(3, axis4);

    XYDataset dataset4 = createDataset("Series 4", 25.0, new Minute(), 200);
    plot.setDataset(3, dataset4);
    plot.mapDatasetToRangeAxis(3, 3);

    XYItemRenderer renderer4 = new StandardXYItemRenderer();
    renderer4.setSeriesPaint(0, Color.green);
    plot.setRenderer(3, renderer4);

    return chart;
}

From source file:com.uniteddev.Unity.Login.java

public static void setup() throws IOException, InterruptedException, FontFormatException {
    //fonts//from   w  w w  .  j ava  2  s  .com
    roboto_thin = Font.createFont(Font.TRUETYPE_FONT, Unity.class.getResourceAsStream("/res/Roboto-Thin.ttf"));
    roboto_regular = Font.createFont(Font.TRUETYPE_FONT,
            Unity.class.getResourceAsStream("/res/Roboto-Regular.ttf"));
    // main
    window = new Window(Unity.title, Unity.favicon, Unity.background, 791, 527);
    release = new Label(Unity.release, Color.WHITE, roboto_regular.deriveFont(Font.PLAIN, 12));
    server_lbl = new Label("Server:", Color.WHITE, roboto_regular.deriveFont(Font.PLAIN, 12));
    server_stat_lbl = new Label("Offline", Color.RED, roboto_regular.deriveFont(Font.PLAIN, 12));
    settingsButton = new Button();
    settingsButton.setImage("/res/gear.png");
    settingsButton.removeDecorations();
    settingsButton.addActionListener(new settingsButton_action());
    // splash screen
    update_lbl = new Label("Updating", Color.WHITE, roboto_thin.deriveFont(Font.PLAIN, 32));
    progress = new ProgressBar(new Color(255, 255, 255, 100), new Color(255, 255, 255, 255));
    progress.removeDecorations();
    progressText = new Label("Ready.", Color.WHITE, roboto_regular.deriveFont(Font.PLAIN, 14));
    // login screen
    username = new TextField(prefs.get("username", ""), Color.WHITE, roboto_regular.deriveFont(Font.PLAIN, 14));
    password = new PasswordField(Color.WHITE, roboto_regular.deriveFont(Font.PLAIN, 14));
    username_lbl = new Label("Username:", Color.WHITE, roboto_regular.deriveFont(Font.PLAIN, 14));
    password_lbl = new Label("Password:", Color.WHITE, roboto_regular.deriveFont(Font.PLAIN, 14));
    loginButton = new Button("Login", Color.WHITE, roboto_thin.deriveFont(Font.PLAIN, 28));
    loginButton.setBorder(BorderFactory.createLineBorder(Color.WHITE, 1));
    loginButton.center();
    loginButton.addActionListener(new loginButton_action());
    invalid_login_lbl = new Label("Invalid Login", Color.RED, roboto_regular.deriveFont(Font.PLAIN, 14));
    invalid_login_lbl.setVisible(false);
    // settings screen
    settings_lbl = new Label("Settings", Color.WHITE, roboto_thin.deriveFont(Font.PLAIN, 32));
    deleteButton = new Button();
    deleteButton.setImage("/res/recycle.png");
    deleteButton.removeDecorations();
    deleteButton.addActionListener(new deleteButton_action());
    ram_size = new TextField(prefs.get("ram_size", default_ram), Color.WHITE,
            roboto_regular.deriveFont(Font.PLAIN, 14));
    ram_lbl = new Label("RAM Usage (MB):", Color.WHITE, roboto_regular.deriveFont(Font.PLAIN, 14));
    invalid_ram_lbl = new Label(Color.RED, roboto_regular.deriveFont(Font.PLAIN, 14));
    invalid_ram_lbl.setVisible(false);
    saveButton = new Button("Save", Color.WHITE, roboto_thin.deriveFont(Font.PLAIN, 28));
    saveButton.setBorder(BorderFactory.createLineBorder(Color.WHITE, 1));
    saveButton.center();
    saveButton.addActionListener(new saveButton_action());
    // sizing and layout
    release.setBounds(5, window.getHeight() - 50, 140, 20);
    server_lbl.setBounds(5, window.getHeight() - 50, 140, 20);
    server_stat_lbl.setBounds(45, window.getHeight() - 50, 200, 20);
    update_lbl.setBounds(115, 20, 320, 50);
    progress.setBounds(20, 75, 320, 10);
    progressText.setBounds(20, 90, 320, 20);
    username.setBounds(155, 30, 115, 20);
    password.setBounds(155, 60, 115, 20);
    username_lbl.setBounds(80, 30, 115, 20);
    password_lbl.setBounds(79, 60, 115, 20);
    loginButton.setBounds(110, 110, 140, 40);
    invalid_login_lbl.setBounds(135, 165, 140, 20);
    settingsButton.setBounds(window.getWidth() - 45, window.getHeight() - 65, 32, 32);
    settings_lbl.setBounds(115, 5, 320, 50);
    deleteButton.setBounds(155, 50, 32, 32);
    ram_size.setBounds(175, 90, 115, 20);
    ram_lbl.setBounds(60, 90, 115, 20);
    saveButton.setBounds(110, 125, 140, 40);
    // setup screens
    login_window = new Label();
    login_window.setBounds(216, 180, 360, 200);
    login_window.add(update_lbl);
    login_window.add(progress);
    login_window.add(progressText);
    login_window.add(username);
    login_window.add(password);
    login_window.add(username_lbl);
    login_window.add(password_lbl);
    login_window.add(loginButton);
    login_window.add(invalid_login_lbl);
    login_window.add(settings_lbl);
    login_window.add(deleteButton);
    login_window.add(ram_size);
    login_window.add(invalid_ram_lbl);
    login_window.add(ram_lbl);
    login_window.add(saveButton);
    // setup and show window
    window.addComponent(release);
    window.addComponent(server_lbl);
    window.addComponent(server_stat_lbl);
    window.addComponent(login_window);
    window.addComponent(settingsButton);
    window.getRootPane().setDefaultButton(loginButton);
    window.setLocationRelativeTo(null);
    release.setVisible(false);
    window.setVisible(true);
    start();
}

From source file:cn.edu.thss.iise.bpmdemo.charts.SWTMultipleAxisDemo1.java

/**
 * Creates the demo chart.// w  w w .java2 s.  co  m
 *
 * @return The chart.
 */
private static JFreeChart createChart() {

    XYDataset dataset1 = createDataset("Series 1", 100.0, new Day(), 200);

    JFreeChart chart = ChartFactory.createTimeSeriesChart("Multiple Axis Demo 3", "Time of Day",
            "Primary Range Axis", dataset1, true, true, false);

    chart.setBackgroundPaint(Color.white);
    chart.setBorderVisible(true);
    chart.setBorderPaint(Color.BLACK);
    TextTitle subtitle = new TextTitle("Four datasets and four range axes.");
    chart.addSubtitle(subtitle);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setOrientation(PlotOrientation.VERTICAL);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);

    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.black);

    // AXIS 2
    NumberAxis axis2 = new NumberAxis("Range Axis 2");
    axis2.setAutoRangeIncludesZero(false);
    axis2.setLabelPaint(Color.red);
    axis2.setTickLabelPaint(Color.red);
    plot.setRangeAxis(1, axis2);
    plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_LEFT);

    XYDataset dataset2 = createDataset("Series 2", 1000.0, new Day(), 170);
    plot.setDataset(1, dataset2);
    plot.mapDatasetToRangeAxis(1, 1);
    XYItemRenderer renderer2 = new StandardXYItemRenderer();
    renderer2.setSeriesPaint(0, Color.red);
    plot.setRenderer(1, renderer2);

    // AXIS 3
    NumberAxis axis3 = new NumberAxis("Range Axis 3");
    axis3.setLabelPaint(Color.blue);
    axis3.setTickLabelPaint(Color.blue);
    // axis3.setPositiveArrowVisible(true);
    plot.setRangeAxis(2, axis3);

    XYDataset dataset3 = createDataset("Series 3", 10000.0, new Day(), 170);
    plot.setDataset(2, dataset3);
    plot.mapDatasetToRangeAxis(2, 2);
    XYItemRenderer renderer3 = new StandardXYItemRenderer();
    renderer3.setSeriesPaint(0, Color.blue);
    plot.setRenderer(2, renderer3);

    // AXIS 4
    NumberAxis axis4 = new NumberAxis("Range Axis 4");
    axis4.setLabelPaint(Color.green);
    axis4.setTickLabelPaint(Color.green);
    plot.setRangeAxis(3, axis4);

    XYDataset dataset4 = createDataset("Series 4", 25.0, new Day(), 200);
    plot.setDataset(3, dataset4);
    plot.mapDatasetToRangeAxis(3, 3);

    XYItemRenderer renderer4 = new StandardXYItemRenderer();
    renderer4.setSeriesPaint(0, Color.green);
    plot.setRenderer(3, renderer4);

    return chart;
}