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.wkm.mtool.service.QRCodeService.java

/**
 * ??(QRCode)/*from  www .  j a  v a 2s  . co  m*/
 * @param content
 * @param imgFile
 */
private void encoderQRCode(String content, File imgFile) {
    try {
        Qrcode qrcodeHandler = new Qrcode();
        qrcodeHandler.setQrcodeErrorCorrect('M');
        qrcodeHandler.setQrcodeEncodeMode('B');
        qrcodeHandler.setQrcodeVersion(7);

        System.out.println(content);
        byte[] contentBytes = content.getBytes(Consts.UTF_8.name());

        BufferedImage bufImg = new BufferedImage(140, 140, BufferedImage.TYPE_INT_RGB);

        Graphics2D gs = bufImg.createGraphics();

        gs.setBackground(Color.WHITE);
        gs.clearRect(0, 0, 140, 140);

        // ? > BLACK
        gs.setColor(Color.BLACK);

        // ??? ???
        int pixoff = 2;
        //  > ?
        if (contentBytes.length > 0 && contentBytes.length < 120) {
            boolean[][] codeOut = qrcodeHandler.calQrcode(contentBytes);
            for (int i = 0; i < codeOut.length; i++) {
                for (int j = 0; j < codeOut.length; j++) {
                    if (codeOut[j][i]) {
                        gs.fillRect(j * 3 + pixoff, i * 3 + pixoff, 3, 3);
                    }
                }
            }
        } else {
            System.err.println("QRCode content bytes length = " + contentBytes.length + " not in [ 0,120 ]. ");
        }

        gs.dispose();
        bufImg.flush();

        // ??QRCode
        ImageIO.write(bufImg, "png", imgFile);

    } catch (Exception e) {
        log.info("Exception:" + e.getMessage());
    }
}

From source file:datojava.jcalendar.DJFechasEspInv.java

@Override
public Color getInvalidForegroundColor() {
    return Color.WHITE;
}

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

/**
 * @see org.springframework.web.servlet.view.AbstractView
 *///from   ww w .j a  va  2s  . 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 = 400;
    int height = 300;

    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("No data available");

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

From source file:HitTestSample.java

public void paintComponent(Graphics g) {
    super.paintComponent(g);
    setBackground(Color.white);
    Graphics2D graphics2D = (Graphics2D) g;

    Point2D origin = computeLayoutOrigin();

    graphics2D.translate(origin.getX(), origin.getY());

    // Draw textLayout.
    textLayout.draw(graphics2D, 0, 0);//from w w w .  j  a  v  a  2s  .  c  o  m

    // Retrieve caret Shapes for insertionIndex.
    Shape[] carets = textLayout.getCaretShapes(insertionIndex);

    graphics2D.setColor(STRONG_CARET_COLOR);
    graphics2D.draw(carets[0]);

    if (carets[1] != null) {
        graphics2D.setColor(WEAK_CARET_COLOR);
        graphics2D.draw(carets[1]);
    }
}

From source file:c.depthchart.ViewerPanel.java

public ViewerPanel() {
    setBackground(Color.WHITE);

    df = new DecimalFormat("0.#"); // 1 dp
    msgFont = new Font("SansSerif", Font.BOLD, 18);

    initChart();//  w  ww .  j  av a 2  s. c om
    configOpenNI();

    histogram = new float[MAX_DEPTH_SIZE];

    imWidth = depthMD.getFullXRes();
    imHeight = depthMD.getFullYRes();
    System.out.println("Image dimensions (" + imWidth + ", " + imHeight + ")");

    // create empty image object of correct size and type
    imgbytes = new byte[imWidth * imHeight];
    image = new BufferedImage(imWidth, imHeight, BufferedImage.TYPE_BYTE_GRAY);

    new Thread(this).start(); // start updating the panel's image
}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.boxcharts.SimpleBox.java

public JFreeChart createChart(DatasetMap datasetMap) {

    BoxAndWhiskerCategoryDataset dataset = (BoxAndWhiskerCategoryDataset) datasetMap.getDatasets().get("1");

    JFreeChart chart = ChartFactory.createBoxAndWhiskerChart(name, categoryLabel, valueLabel, dataset, false);

    TextTitle title = setStyleTitle(name, styleTitle);
    chart.setTitle(title);/*from w ww . j  a  v a2 s.  c  o m*/
    if (subName != null && !subName.equals("")) {
        TextTitle subTitle = setStyleTitle(subName, styleSubTitle);
        chart.addSubtitle(subTitle);
    }

    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    BoxAndWhiskerRenderer renderer = (BoxAndWhiskerRenderer) plot.getRenderer();
    chart.setBackgroundPaint(Color.white);

    plot.setBackgroundPaint(new Color(Integer.decode("#c0c0c0").intValue()));
    plot.setDomainGridlinePaint(Color.WHITE);
    plot.setDomainGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);
    renderer.setFillBox(true);
    renderer.setArtifactPaint(Color.BLACK);
    renderer.setSeriesPaint(0, new Color(Integer.decode("#0000FF").intValue()));

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setRange(min, max);

    return chart;
}

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

private static Paint[] createPaint() {
    Paint apaint[] = new Paint[5];
    apaint[0] = new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, Color.white);
    apaint[1] = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, Color.white);
    apaint[2] = new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, Color.white);
    apaint[3] = new GradientPaint(0.0F, 0.0F, Color.orange, 0.0F, 0.0F, Color.white);
    apaint[4] = new GradientPaint(0.0F, 0.0F, Color.magenta, 0.0F, 0.0F, Color.white);
    return apaint;
}

From source file:com.pureinfo.srm.reports.impl.PieChartBuilder.java

/**
 * @throws PureException//from   w w w .j  a v  a2 s.  co m
 * @see com.pureinfo.srm.reports.IChartBuilder#draw(java.util.List, int)
 */
public JFreeChart buildChart() {
    Iterator result = m_datas.iterator();
    DefaultPieDataset ds = getDataset(result);

    JFreeChart jfreechart = ChartFactory.createPieChart3D(null, ds, false, false, false);
    jfreechart.setBackgroundPaint(Color.WHITE);

    PiePlot3D pieplot3d = (PiePlot3D) jfreechart.getPlot();
    pieplot3d.setOutlinePaint(Color.GRAY);
    pieplot3d.setOutlineStroke(new BasicStroke(1));
    pieplot3d.setStartAngle(30D);
    pieplot3d.setDepthFactor(0.04);
    pieplot3d.setDrawingSupplier(new DefaultDrawingSupplier(MyPaintMgr.getPaints(),
            DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE,
            DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE));

    pieplot3d.setCircular(false);
    pieplot3d.setDirection(Rotation.CLOCKWISE);
    pieplot3d.setOutlinePaint(Color.WHITE);
    pieplot3d.setInteriorGap(.15);
    Color color = new Color(0xaa, 0xaa, 0xaa, 255);
    pieplot3d.setBaseSectionOutlinePaint(color);
    pieplot3d.setBaseSectionOutlineStroke(new BasicStroke(0));
    pieplot3d.setForegroundAlpha(0.6f);
    pieplot3d.setLabelLinkStroke(new BasicStroke(1));
    pieplot3d.setLabelOutlinePaint(new Color(0x777777));
    pieplot3d.setLabelBackgroundPaint(new Color(0xf1f1f7));
    pieplot3d.setLabelLinkPaint(new Color(0xaa, 0xaa, 0xaa, 60));
    pieplot3d.setNoDataMessage("No data to display");
    pieplot3d.setLabelShadowPaint(new Color(0xdddddd));
    pieplot3d.setLabelFont(new Font("", Font.PLAIN, 10));
    if (m_nType == TYPE_PERCENT) {

        pieplot3d.setLabelGenerator(new StandardPieItemLabelGenerator("{0} = {2}",
                NumberFormat.getNumberInstance(), PERCENT_NUMBER_FORMAT));
    }

    fillChartInfo(ds);
    return jfreechart;
}

From source file:figs.Chart.java

public void createChart() {
    final XYPlot plot = chart.getXYPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setBaseLinesVisible(false);
    renderer.setBaseShapesVisible(true);
    plot.setRenderer(renderer);//from  w  w  w  .j a v  a  2 s .co  m
    chart.setBackgroundPaint(Color.white);
    plot.setOutlinePaint(Color.black);
}

From source file:com.che.software.testato.util.jfreechart.LineChartGraphistUtil.java

/**
 * Colorized and transforms a given JFreeChart.
 * /*from   www . j ava 2  s  . c  om*/
 * @author Clement HELIOU (clement.heliou@che-software.com).
 * @param lineChart the given chart.
 * @param maxAbscissaValue the max abscissa value of the chart.
 * @param xValues the x axis values list.
 * @param yValues the y axis values list.
 * @param xExcludedValues the x axis excluded values.
 * @param yExcludedValues the y axis excluded values.
 * @return the transformed chart.
 * @since August, 2011.
 */
public static JFreeChart getColorizedChartFromChart(JFreeChart lineChart, double maxAbscissaValue,
        List<MatrixResult> xValues, List<MatrixResult> yValues, List<MatrixResult> xExcludedValues,
        List<MatrixResult> yExcludedValues) {
    LOGGER.debug("getColorizedChartFromChart().");
    lineChart.setBackgroundPaint(Color.WHITE);
    XYPlot plot = (XYPlot) lineChart.getPlot();
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesLinesVisible(0, false);
    renderer.setSeriesLinesVisible(1, false);
    renderer.setSeriesStroke(2, new BasicStroke(2));
    renderer.setSeriesStroke(3, new BasicStroke(2));
    renderer.setSeriesShapesVisible(2, false);
    renderer.setSeriesShapesVisible(3, false);
    renderer.setSeriesPaint(0,
            ColorUtil.getHSBColor(ColorUtil.BLUE_COLOR[0], ColorUtil.BLUE_COLOR[1], ColorUtil.BLUE_COLOR[2]));
    renderer.setSeriesPaint(1, ColorUtil.getHSBColor(ColorUtil.ORANGE_COLOR[0], ColorUtil.ORANGE_COLOR[1],
            ColorUtil.ORANGE_COLOR[2]));
    renderer.setSeriesPaint(2, ColorUtil.getHSBColor(ColorUtil.DARK_BLUE_COLOR[0], ColorUtil.DARK_BLUE_COLOR[1],
            ColorUtil.DARK_BLUE_COLOR[2]));
    renderer.setSeriesPaint(3, ColorUtil.getHSBColor(ColorUtil.DARK_BLUE_COLOR[0], ColorUtil.DARK_BLUE_COLOR[1],
            ColorUtil.DARK_BLUE_COLOR[2]));
    plot.setRenderer(renderer);
    XYTextAnnotation low = new XYTextAnnotation(
            LocaleUtil.getResourceBundleStringByName(LocaleUtil.AREA_LOW_NAME), (0.5 * maxAbscissaValue) - 1,
            maxAbscissaValue + 1),
            medium = new XYTextAnnotation(LocaleUtil.getResourceBundleStringByName(LocaleUtil.AREA_MEDIUM_NAME),
                    (1.5 * maxAbscissaValue) - 2, maxAbscissaValue + 1),
            high = new XYTextAnnotation(LocaleUtil.getResourceBundleStringByName(LocaleUtil.AREA_HIGH_NAME),
                    1.5 * maxAbscissaValue, maxAbscissaValue - 2);
    low.setFont(ColorUtil.TITLE_FONT);
    medium.setFont(ColorUtil.TITLE_FONT);
    high.setFont(ColorUtil.TITLE_FONT);
    low.setPaint(ColorUtil.getHSBColor(ColorUtil.DARK_BLUE_COLOR[0], ColorUtil.DARK_BLUE_COLOR[1],
            ColorUtil.DARK_BLUE_COLOR[2]));
    medium.setPaint(ColorUtil.getHSBColor(ColorUtil.DARK_BLUE_COLOR[0], ColorUtil.DARK_BLUE_COLOR[1],
            ColorUtil.DARK_BLUE_COLOR[2]));
    high.setPaint(ColorUtil.getHSBColor(ColorUtil.DARK_BLUE_COLOR[0], ColorUtil.DARK_BLUE_COLOR[1],
            ColorUtil.DARK_BLUE_COLOR[2]));
    plot.addAnnotation(low);
    plot.addAnnotation(medium);
    plot.addAnnotation(high);
    for (int i = 0; i < xValues.size(); i++) {
        XYTextAnnotation itemLabel = new XYTextAnnotation(xValues.get(i).getScriptLabel(),
                (yValues.get(i).getPercentage() * 100), (xValues.get(i).getPercentage() * 100) + 0.5);
        itemLabel.setFont(ColorUtil.DEFAULT_FONT);
        itemLabel.setPaint(ColorUtil.getHSBColor(ColorUtil.BLUE_COLOR[0], ColorUtil.BLUE_COLOR[1],
                ColorUtil.BLUE_COLOR[2]));
        plot.addAnnotation(itemLabel);
    }
    if (null != xExcludedValues) {
        for (int j = 0; j < xExcludedValues.size(); j++) {
            XYTextAnnotation itemLabel = new XYTextAnnotation(xExcludedValues.get(j).getScriptLabel(),
                    (yExcludedValues.get(j).getPercentage() * 100),
                    (xExcludedValues.get(j).getPercentage() * 100) + 0.5);
            itemLabel.setFont(ColorUtil.DEFAULT_FONT);
            itemLabel.setPaint(ColorUtil.getHSBColor(ColorUtil.ORANGE_COLOR[0], ColorUtil.ORANGE_COLOR[1],
                    ColorUtil.ORANGE_COLOR[2]));
            plot.addAnnotation(itemLabel);
        }
    }
    return lineChart;
}