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:com.tencent.wstt.apt.chart.AbstractRealTimeLineChart.java

/**
 * ?jfreechatpanel/*from www .  j  a  v a2 s.co  m*/
 */
public AbstractRealTimeLineChart() {
    super(new BorderLayout());
    chart = createChart();
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4),
            BorderFactory.createLineBorder(Color.black)));
    this.add(chartPanel);
}

From source file:components.ComboBoxDemo2.java

public ComboBoxDemo2() {
    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    String[] patternExamples = { "dd MMMMM yyyy", "dd.MM.yy", "MM/dd/yy", "yyyy.MM.dd G 'at' hh:mm:ss z",
            "EEE, MMM d, ''yy", "h:mm a", "H:mm:ss:SSS", "K:mm a,z", "yyyy.MMMMM.dd GGG hh:mm aaa" };

    currentPattern = patternExamples[0];

    //Set up the UI for selecting a pattern.
    JLabel patternLabel1 = new JLabel("Enter the pattern string or");
    JLabel patternLabel2 = new JLabel("select one from the list:");

    JComboBox patternList = new JComboBox(patternExamples);
    patternList.setEditable(true);/*from  w  ww  .  ja v a  2  s.  co m*/
    patternList.addActionListener(this);

    //Create the UI for displaying result.
    JLabel resultLabel = new JLabel("Current Date/Time", JLabel.LEADING); //== LEFT
    result = new JLabel(" ");
    result.setForeground(Color.black);
    result.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.black),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    //Lay out everything.
    JPanel patternPanel = new JPanel();
    patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.PAGE_AXIS));
    patternPanel.add(patternLabel1);
    patternPanel.add(patternLabel2);
    patternList.setAlignmentX(Component.LEFT_ALIGNMENT);
    patternPanel.add(patternList);

    JPanel resultPanel = new JPanel(new GridLayout(0, 1));
    resultPanel.add(resultLabel);
    resultPanel.add(result);

    patternPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    resultPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    add(patternPanel);
    add(Box.createRigidArea(new Dimension(0, 10)));
    add(resultPanel);

    setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    reformat();
}

From source file:image.text.CreateTifAndAnnotate.java

public void createAnnotatedTif(String[] args, OutputStream out) throws Exception {

    byte[] byteArray = new byte[] { -1, 0 };
    ColorModel colorModel = new IndexColorModel(1, 2, byteArray, byteArray, byteArray);

    WritableRaster writeableRaster = Raster.createPackedRaster(DataBuffer.TYPE_BYTE, 1700, 2200, 1, 1, null);
    BufferedImage bufImg = new BufferedImage(colorModel, writeableRaster, false, null);

    // -------------------------------------------------------------------        
    Graphics2D g2d = bufImg.createGraphics();
    g2d.setColor(Color.black);

    Font font = new Font("Arial Bold", Font.PLAIN, 36);
    g2d.setFont(font);//from www.j a v a 2s .  co  m
    int vertPos = 200;
    for (int i = 0; i < args.length; i++) {
        g2d.drawString(args[i], 75, vertPos);
        vertPos += 48;
    }

    PlanarImage planarImage = PlanarImage.wrapRenderedImage(bufImg);

    TIFFEncodeParam encodeParam = new TIFFEncodeParam();
    encodeParam.setCompression(TIFFEncodeParam.COMPRESSION_GROUP4);
    encodeParam.setWriteTiled(false); // false means use strips.
    encodeParam.setTileSize(0, 0); // tiling will make the file size much larger. 
    encodeParam.setLittleEndian(true); // create an Intel (II) format image

    String SoftwareVersion[] = new String[] { "TIFF by Joe, " + this.getClass().getName() };
    String docName[] = new String[] { "JoesTifAnnotator" };

    // Create a new TIFF fields including a new TIFF ASCII TIFF tag.
    TIFFField tiffFields[] = new TIFFField[5];

    tiffFields[0] = new TIFFField(269, TIFFField.TIFF_ASCII, docName.length, docName);
    tiffFields[1] = new TIFFField(282, TIFFField.TIFF_RATIONAL, 1, new long[][] { { 200, 1 } });
    tiffFields[2] = new TIFFField(283, TIFFField.TIFF_RATIONAL, 1, new long[][] { { 200, 1 } });
    // resolution unit 
    tiffFields[3] = new TIFFField(296, TIFFField.TIFF_SHORT, 1, new char[] { 2 });
    tiffFields[4] = new TIFFField(305, TIFFField.TIFF_ASCII, SoftwareVersion.length, SoftwareVersion);

    encodeParam.setExtraFields(tiffFields);

    TIFFImageEncoder encoder = new TIFFImageEncoder(out, encodeParam);
    encoder.encode(planarImage);
}

From source file:daylightchart.daylightchart.chart.DaylightChartLegendItemSource.java

private LegendItem createLegendItem(final String label, final Paint paint, final boolean isLine) {
    final LegendItem legendItem = new LegendItem(label, /* description */
            null, /* toolTipText */null, /* urlText */
            null, /* shapeVisible */!isLine, /* shape */new Rectangle(10, 10), /* shapeFilled */true, paint,
            /* shapeOutlineVisible */true, /* outlinePaint */Color.black,
            /* outlineStroke */new BasicStroke(0.2f), /* lineVisible */isLine, /* line */new Rectangle(10, 3),
            /* lineStroke */new BasicStroke(0.6f), /* linePaint */Color.black);

    return legendItem;
}

From source file:com.orsonpdf.demo.PDFBarChartDemo1.java

/**
 * Creates a sample chart./* w w w  .  j  a v  a  2  s .co m*/
 *
 * @param dataset  a dataset.
 *
 * @return The chart.
 */
private static JFreeChart createChart(CategoryDataset dataset) {

    // create the chart...
    JFreeChart chart = ChartFactory.createLineChart("Statistical Bar Chart Demo 1", "Type", "Value", dataset,
            PlotOrientation.VERTICAL, true, false, false);

    CategoryPlot plot = (CategoryPlot) chart.getPlot();

    // customise the range axis...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setAutoRangeIncludesZero(false);

    // customise the renderer...
    StatisticalBarRenderer renderer = new StatisticalBarRenderer();
    renderer.setDrawBarOutline(false);
    renderer.setErrorIndicatorPaint(Color.black);
    renderer.setIncludeBaseInRange(false);
    plot.setRenderer(renderer);

    // ensure the current theme is applied to the renderer just added
    ChartUtilities.applyCurrentTheme(chart);

    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);
    renderer.setBaseItemLabelPaint(Color.yellow);
    renderer.setBasePositiveItemLabelPosition(
            new ItemLabelPosition(ItemLabelAnchor.INSIDE6, TextAnchor.BOTTOM_CENTER));

    // set up gradient paints for series...
    GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64));
    GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0));
    renderer.setSeriesPaint(0, gp0);
    renderer.setSeriesPaint(1, gp1);
    return chart;
}

From source file:view.FuzzySetView.java

/**
 *
 * @param value/*from w  w w  . jav  a2s.  c o m*/
 */
public void showSingleton(double value) {
    plot.clearDomainMarkers();

    BasicStroke stroke = new BasicStroke(2f);
    ValueMarker marker = new ValueMarker(value, Color.BLACK, stroke);
    plot.addDomainMarker(marker);

    fillView();
}

From source file:BookTree.java

public BookCellRenderer() {
    renderer = new JPanel(new GridLayout(0, 1));
    titleLabel = new JLabel(" ");
    titleLabel.setForeground(Color.blue);
    renderer.add(titleLabel);//  w  w  w  .  ja v  a  2s  .co  m
    authorsLabel = new JLabel(" ");
    authorsLabel.setForeground(Color.blue);
    renderer.add(authorsLabel);
    priceLabel = new JLabel(" ");
    priceLabel.setHorizontalAlignment(JLabel.RIGHT);
    priceLabel.setForeground(Color.red);
    renderer.add(priceLabel);
    renderer.setBorder(BorderFactory.createLineBorder(Color.black));
    backgroundSelectionColor = defaultRenderer.getBackgroundSelectionColor();
    backgroundNonSelectionColor = defaultRenderer.getBackgroundNonSelectionColor();
}

From source file:org.tsho.dmc2.core.chart.CyclesRenderer.java

public void render(final Graphics2D g2, final Rectangle2D dataArea, final PlotRenderingInfo info) {
    ValueAxis domainAxis = plot.getDomainAxis();
    ValueAxis rangeAxis = plot.getRangeAxis();

    state = STATE_RUNNING;/*w w w  .  ja  v a2s  . co m*/

    g2.setColor(Color.BLACK);

    VariableDoubles initialValues = map.getVariables();
    int xLabelIndex = VariableDoubles.indexOf(initialValues, xLabel);
    int yLabelIndex = VariableDoubles.indexOf(initialValues, yLabel);

    int x, y;
    String varNames[] = map.getVarNames();
    int dim = map.getNVar();
    double tmp[] = new double[dim];
    double tmp1[] = new double[dim];
    double vRangeMax[] = VariableDoubles.toArray(rangeMax);
    double vRangeMin[] = VariableDoubles.toArray(rangeMin);
    double[] cycle;
    double[] cycleModulus = new double[dim];

    double[][] list = new double[period][dim];

    int counter = 0;
    main: while (counter < maxPoints) {

        if (stopped) {
            state = STATE_STOPPED;
            return;
        }

        for (int iii = 0; iii < dim; iii++) {
            double val = (vRangeMax[iii] - vRangeMin[iii]) * Math.random();
            initialValues.put(varNames[iii], vRangeMin[iii] + val);
        }
        counter++;

        try {
            cycle = Lua.findCycles(map, parameters, period, initialValues, epsilon, 100, cycleModulus);
        } catch (AlgorithmFailedException e) {
            continue;
        }

        if (period > 1) {
            System.arraycopy(cycle, 0, list[0], 0, dim);

            for (int i = 0; i < period - 1; i++) { /*fill cycle data*/
                map.evaluate(VariableDoubles.toArray(parameters), list[i], list[i + 1]);
            }

            // compare i + 1 with all previous
            for (int j = 0; j < period; j++) {
                for (int i = j + 1; i < period; i++) {
                    if (equal(list[j], list[i], epsilon)) {
                        continue main;
                    }
                }
            }

            // check if it's a real solution
            map.evaluate(VariableDoubles.toArray(parameters), list[period - 1], tmp);
            if (!equal(tmp, list[0], epsilon))
                continue main;

            checkStability(cycleModulus, g2);

            for (int i = 0; i < period; i++) {
                x = (int) domainAxis.valueToJava2D(list[i][xLabelIndex], dataArea, RectangleEdge.BOTTOM);

                y = (int) rangeAxis.valueToJava2D(list[i][yLabelIndex], dataArea, RectangleEdge.LEFT);
                if (bigDots) {
                    g2.fillRect(x - 1, y - 1, 3, 3);
                } else {
                    g2.fillRect(x, y, 1, 1);
                }
            }
        } else { // period == 1
            x = (int) domainAxis.valueToJava2D(cycle[xLabelIndex], dataArea, RectangleEdge.BOTTOM);

            y = (int) rangeAxis.valueToJava2D(cycle[yLabelIndex], dataArea, RectangleEdge.LEFT);

            // check if it's a real solution
            map.evaluate(VariableDoubles.toArray(parameters), cycle, tmp);
            if (!equal(tmp, cycle, epsilon))
                continue main;

            checkStability(cycleModulus, g2);

            if (bigDots) {
                g2.fillRect(x - 1, y - 1, 3, 3);
            } else {
                g2.fillRect(x, y, 1, 1);
            }
        }

    }

    state = STATE_FINISHED;
}

From source file:com.gargoylesoftware.htmlunit.javascript.host.canvas.rendering.AwtRenderingBackend.java

/**
 * {@inheritDoc}/*  ww w .  j  av a2 s .  c  om*/
 */
public void setFillStyle(final String fillStyle) {
    final String tmpFillStyle = fillStyle.replaceAll("\\s", "");
    Color color = null;
    if (tmpFillStyle.startsWith("rgb(")) {
        final String[] colors = tmpFillStyle.substring(4, tmpFillStyle.length() - 1).split(",");
        color = new Color(Integer.parseInt(colors[0]), Integer.parseInt(colors[1]),
                Integer.parseInt(colors[2]));
    } else if (tmpFillStyle.startsWith("rgba(")) {
        final String[] colors = tmpFillStyle.substring(5, tmpFillStyle.length() - 1).split(",");
        color = new Color(Integer.parseInt(colors[0]), Integer.parseInt(colors[1]), Integer.parseInt(colors[2]),
                (int) (Float.parseFloat(colors[3]) * 255));
    } else if (tmpFillStyle.startsWith("#")) {
        color = Color.decode(tmpFillStyle);
    } else {
        try {
            final Field f = Color.class.getField(tmpFillStyle);
            color = (Color) f.get(null);
        } catch (final Exception e) {
            LOG.info("Can not find color '" + tmpFillStyle + '\'');
            color = Color.black;
        }
    }
    graphics2D_.setColor(color);
}

From source file:CopyAreaPerformance.java

private void drawSmiley(Graphics g, Color faceColor, int x, int y) {
    // fill face color
    g.setColor(faceColor);//from w ww  .  j a v  a2s .c  o  m
    g.fillOval(x, y, SMILEY_SIZE, SMILEY_SIZE);
    g.setColor(Color.BLACK);
    // draw head
    g.drawOval(x, y, SMILEY_SIZE, SMILEY_SIZE);
    // draw smile
    g.drawArc(x + (int) ((SMILEY_SIZE * .2)), (int) (y + (SMILEY_SIZE * .2)), (int) (SMILEY_SIZE * .6),
            (int) (SMILEY_SIZE * .6), 200, 140);
    // draw eyes
    int eyeSize = Math.max(2, (int) (SMILEY_SIZE * .1));
    g.fillOval(x + (int) ((SMILEY_SIZE * .5) - (SMILEY_SIZE * .1) - eyeSize), y + (int) (SMILEY_SIZE * .3),
            eyeSize, eyeSize);
    g.fillOval(x + (int) ((SMILEY_SIZE * .5) + (SMILEY_SIZE * .1)), y + (int) (SMILEY_SIZE * .3), eyeSize,
            eyeSize);
}