Example usage for java.awt Color BLACK

List of usage examples for java.awt Color BLACK

Introduction

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

Prototype

Color BLACK

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

Click Source Link

Document

The color black.

Usage

From source file:org.pau.assetmanager.viewmodel.chart.PrepareChart.java

public static void prepareBalanceChart(JFreeChart jfchart) {

    CategoryPlot categoryPlot = ((CategoryPlot) jfchart.getPlot());
    NumberAxis numberAxis = (NumberAxis) categoryPlot.getRangeAxis();
    numberAxis.setAutoRange(true);//from w  w w  .j a va 2  s  .co  m
    numberAxis.setAutoRangeIncludesZero(false);
    categoryPlot.setBackgroundPaint(Color.WHITE);
    categoryPlot.setDomainGridlinePaint(Color.WHITE);
    categoryPlot.setRangeMinorGridlinePaint(Color.WHITE);
    categoryPlot.setRangeGridlinePaint(Color.BLACK);
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) categoryPlot.getRenderer();

    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);

    commonPrepareJFreeChart(renderer);

    renderer.setSeriesPaint(0, Color.black);

    renderer.setSeriesItemLabelPaint(0, Color.black);

}

From source file:soap.ui.stats.OverLaidBarChartFactory.java

public static JFreeChart createDualBarAndLineDiagram(String title, String categoryAxisLabel,
        String valueAxisLabel, CategoryDataset barDiagramDataset, LinkedList lineDiagramDatasets) {
    CategoryPlot plot = new CategoryPlot();
    int inc = 0;//  w  ww.j a v  a 2s.c  o m
    BarRenderer barRenderer = null;
    if (barDiagramDataset != null) {
        plot.setDataset(barDiagramDataset);
        barRenderer = new BarRenderer3D();
        barRenderer.setToolTipGenerator(new StandardCategoryToolTipGenerator());
        plot.setRenderer(barRenderer);
        inc = 1;
        plot.setDomainAxis(new CategoryAxis3D(categoryAxisLabel));
        plot.setRangeAxis(new NumberAxis3D(valueAxisLabel));
    } else {
        plot.setDomainAxis(new CategoryAxis(categoryAxisLabel));
        plot.setRangeAxis(new NumberAxis(valueAxisLabel));
    }
    plot.mapDatasetToRangeAxis(0, 0);

    plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    plot.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);

    CategoryItemRenderer renderers[] = new LineAndShapeRenderer[lineDiagramDatasets.size()];

    for (int i = 0; i < lineDiagramDatasets.size(); i++) {
        CategoryDataset lineDiagramDataset = (CategoryDataset) lineDiagramDatasets.get(i);
        plot.setDataset(i + inc, lineDiagramDataset);
        plot.mapDatasetToRangeAxis(i + inc, 0);
        if (barDiagramDataset != null && i < barDiagramDataset.getRowCount()) {
            renderers[i] = new LineAndShapeRendererMapToBar(barRenderer, i);
        } else {
            renderers[i] = new LineAndShapeRenderer();
        }
        renderers[i].setToolTipGenerator(new StandardCategoryToolTipGenerator());
        renderers[i].setSeriesStroke(0, new BasicStroke(1.5f));
        renderers[i].setSeriesStroke(1, new BasicStroke(1.5f));
        plot.setRenderer(i + inc, renderers[i]);
    }

    CategoryDataset dataset;
    if (lineDiagramDatasets.size() > 0)
        dataset = (CategoryDataset) lineDiagramDatasets.get(0);
    else
        dataset = barDiagramDataset;
    for (int i = 0; i < dataset.getColumnCount(); i++)
        plot.getDomainAxis().addCategoryLabelToolTip(dataset.getColumnKey(i), (String) dataset.getColumnKey(i));

    plot.setRangeGridlinePaint(Color.black);
    plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);

    JFreeChart chart = new JFreeChart(plot);
    chart.setTitle(title);
    chart.setLegend(new StandardLegend());

    return chart;
}

From source file:com.porepw.porli.frame.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    // TODO add your handling code here:
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(60, "Marks", "Student 1");
    dataset.setValue(40, "Marks", "Student 2");
    dataset.setValue(90, "Marks", "Student 3");
    dataset.setValue(50, "Marks", "Student 4");
    dataset.setValue(70, "Marks", "Student 5");
    dataset.setValue(30, "Marks", "Student 6");

    JFreeChart chart = ChartFactory.createLineChart("Student Marks", "Student Name", "Marks", dataset,
            PlotOrientation.HORIZONTAL, false, true, false);
    CategoryPlot p = chart.getCategoryPlot();
    p.setRangeGridlinePaint(Color.BLACK);
    ChartPanel panel = new ChartPanel(chart);
    panel.setDomainZoomable(true);/* w  w w. j a  v a  2 s. c  o m*/
    jPanel2.add(panel, BorderLayout.CENTER);
    panel.setPreferredSize(new java.awt.Dimension(500, 270));
}

From source file:ConvolveApp.java

CPanel() {
    setBackground(Color.black);
    loadImage();
    setSize(displayImage.getWidth(this), displayImage.getWidth(this));
    createBufferedImages();
    bi = biSrc;
}

From source file:net.sf.jsfcomp.chartcreator.utils.ChartUtils.java

public static Color getColor(String color) {
    // HTML colors (#FFFFFF format)
    if (color.startsWith("#")) {
        return new Color(Integer.parseInt(color.substring(1), 16));
    } else {//from ww  w. j a  v  a  2s  .  co  m
        // Colors by name
        if (color.equalsIgnoreCase("black"))
            return Color.black;
        if (color.equalsIgnoreCase("gray"))
            return Color.gray;
        if (color.equalsIgnoreCase("yellow"))
            return Color.yellow;
        if (color.equalsIgnoreCase("green"))
            return Color.green;
        if (color.equalsIgnoreCase("blue"))
            return Color.blue;
        if (color.equalsIgnoreCase("red"))
            return Color.red;
        if (color.equalsIgnoreCase("orange"))
            return Color.orange;
        if (color.equalsIgnoreCase("cyan"))
            return Color.cyan;
        if (color.equalsIgnoreCase("magenta"))
            return Color.magenta;
        if (color.equalsIgnoreCase("darkgray"))
            return Color.darkGray;
        if (color.equalsIgnoreCase("lightgray"))
            return Color.lightGray;
        if (color.equalsIgnoreCase("pink"))
            return Color.pink;
        if (color.equalsIgnoreCase("white"))
            return Color.white;

        throw new RuntimeException("Unsupported chart color:" + color);
    }
}

From source file:org.tap4j.plugin.util.GraphHelper.java

public static JFreeChart createChart(StaplerRequest req, CategoryDataset dataset) {

    final JFreeChart chart = ChartFactory.createStackedAreaChart("TAP Tests", // chart title
            null, // unused
            "TAP Tests Count", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
    );/* w w  w .  j  a v a 2  s  .  co  m*/

    // 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.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setForegroundAlpha(0.8f);
    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(Color.white);
    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());

    StackedAreaRenderer ar = new StackedAreaRenderer2() {
        private static final long serialVersionUID = 331915263367089058L;

        @Override
        public String generateURL(CategoryDataset dataset, int row, int column) {
            NumberOnlyBuildLabel label = (NumberOnlyBuildLabel) dataset.getColumnKey(column);
            return label.build.getNumber() + "/" + AbstractTapProjectAction.URL_NAME + "/";
        }

        @Override
        public String generateToolTip(CategoryDataset dataset, int row, int column) {
            NumberOnlyBuildLabel label = (NumberOnlyBuildLabel) dataset.getColumnKey(column);
            TapBuildAction build = label.build.getAction(TapBuildAction.class);
            TapResult report = build.getResult();
            report.tally();

            switch (row) {
            case 0:
                return String.valueOf(report.getFailed()) + " Failure(s)";
            case 1:
                return String.valueOf(report.getPassed()) + " Pass";
            case 2:
                return String.valueOf(report.getSkipped()) + " Skip(s)";
            default:
                return "";
            }
        }

    };

    plot.setRenderer(ar);
    ar.setSeriesPaint(0, ColorPalette.RED); // Failures
    ar.setSeriesPaint(1, ColorPalette.BLUE); // Pass
    ar.setSeriesPaint(2, ColorPalette.YELLOW); // Skips

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

    return chart;
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.AnnotationReportApplet.java

public void paint(Graphics g) {

    super.paint(g);

    // Draw a 2-pixel border
    g.setColor(Color.black);

    int width = getSize().width; // Width of the applet.
    int height = getSize().height; // Height of the applet.
    g.drawRect(0, 0, width - 1, height - 1);
    g.drawRect(1, 1, width - 3, height - 3);
}

From source file:gov.llnl.lc.infiniband.opensm.plugin.gui.chart.PaintScaleFactory.java

public static LookupPaintScale getLookupPaintScale(int type, double lower, double upper, double maxValue) {
    LookupPaintScale lps = new LookupPaintScale(lower, upper, defaultColor);
    double inc = maxColor / maxDivisions;
    double cinc = inc * 2.0;
    int half = maxDivisions / 2;
    double cdiv = maxValue / maxDivisions;

    lps.add(0, Color.black);

    if (type == 0) {
        Color[] gColors = generateColors(maxDivisions - 1);
        for (int i = 1; i < maxDivisions; i++) {
            double cval = (double) i * cdiv;
            lps.add(cval, gColors[i - 1]);
        }/* w w  w .j a va 2s  .co  m*/
    } else if (type == 1) {
        for (int i = 1; i < maxDivisions; i++) {
            //
            boolean firstHalf = i < half;
            int rval = firstHalf ? 0 : (int) ((i - half) * cinc);
            int gval = firstHalf ? (int) (i * cinc) : 510 - (int) (i * cinc);
            int bval = firstHalf ? 255 - (int) (i * cinc) : 0;
            double cval = (double) i * cdiv;
            lps.add(cval, new Color(rval, gval, bval));
            //        System.err.println(i + ") V:" + cval + ", R:" + rval + ", G:" + gval + ", B:" + bval);
        }
    } else {
        for (int i = 1; i < maxDivisions; i++) {
            // red slowly ramps up, and blue slowly ramps down
            boolean firstHalf = i < half;
            int rval = (int) (i * inc);
            int gval = firstHalf ? (int) (i * cinc) : 510 - (int) (i * cinc);
            int bval = 255 - rval;
            double cval = (double) i * cdiv;
            lps.add(cval, new Color(rval, gval, bval));
            //        System.err.println(i + ") V:" + cval + ", R:" + rval + ", G:" + gval + ", B:" + bval);
        }
    }
    //    System.err.println("Color type: " + type);
    return lps;
}

From source file:IHM.compargraph.java

/**
 *
 * @param title//from w w w .j  av a  2  s. c  om
 * @param c1
 * @param c2
 * @param comp
 * 
 */
public compargraph(String title, ArrayList<ReleveMeteo> c1, ArrayList<ReleveMeteo> c2, String comp) {
    super(title);
    t1 = c1;
    t2 = c2;
    c = comp;

    // jp = new JInternalFrame("courbes");

    JFreeChart chart = createChart(createDataset());
    ChartPanel panel = new ChartPanel(chart);
    panel.setPreferredSize(new Dimension(500, 300));
    setContentPane(panel);
    //  jp.add(panel, BorderLayout.EAST);
    //  jp.setVisible(true);
    panel.setVisible(true);
    XYPlot plot = chart.getXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    plot.setRenderer(renderer);
    renderer.setSeriesPaint(0, Color.RED);
    renderer.setSeriesPaint(1, Color.GREEN);
    renderer.setSeriesPaint(2, Color.YELLOW);
    // sets thickness for series (using strokes)
    renderer.setSeriesStroke(0, new BasicStroke(4.0f));
    renderer.setSeriesStroke(1, new BasicStroke(3.0f));
    renderer.setSeriesStroke(2, new BasicStroke(2.0f));
    plot.setRenderer(renderer);
    plot.setOutlinePaint(Color.BLUE);
    plot.setOutlineStroke(new BasicStroke(2.0f));
    plot.setBackgroundPaint(Color.DARK_GRAY);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.BLACK);
    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(Color.BLACK);

}

From source file:net.sf.fspdfs.chartthemes.spring.ScaledDialPointer.java

/**
 * Creates a new instance.//from   w ww  .j av a2s . com
 *
 * @param datasetIndex  the dataset index.
 */
public ScaledDialPointer(int scale, double widthRadius) {
    this(0, widthRadius, Color.BLACK, Color.BLACK, scale);
}