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:Highlights.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;

    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);

    String s = "Drag the text to highlight Java Source and Support.";
    Font font = new Font("Serif", Font.PLAIN, 32);

    if (textLayout == null) {
        FontRenderContext frc = g2.getFontRenderContext();
        textLayout = new TextLayout(s, font, frc);
    }/*www . j a va2 s  .c  om*/

    // Draw the highlight.
    if (firstHit != null && secondHit != null) {
        Shape base = textLayout.getLogicalHighlightShape(firstHit.getInsertionIndex(),
                secondHit.getInsertionIndex());
        AffineTransform at = AffineTransform.getTranslateInstance(x, y);
        Shape highlight = at.createTransformedShape(base);
        g2.setPaint(Color.white);
        g2.fill(highlight);
    }

    g2.setPaint(Color.black);
    textLayout.draw(g2, x, y);
}

From source file:org.openmrs.module.usagestatistics.web.view.chart.FoundByChartView.java

@Override
protected JFreeChart createChart(Map<String, Object> model, HttpServletRequest request) {
    UsageStatisticsService svc = Context.getService(UsageStatisticsService.class);
    int[] stats = svc.getFoundByStats(getFromDate(), getUntilInclusiveDate(), getLocation(), getUsageFilter());

    String labelLink = ContextProvider.getMessage("usagestatistics.foundBy.directLink");
    String labelId = ContextProvider.getMessage("usagestatistics.foundBy.idSearch");
    String labelName = ContextProvider.getMessage("usagestatistics.foundBy.nameSearch");

    double total = stats[0];
    DefaultPieDataset dataset = new DefaultPieDataset();
    dataset.setValue(labelLink, 100.0 * stats[1] / total);
    dataset.setValue(labelId, 100.0 * stats[2] / total);
    dataset.setValue(labelName, 100.0 * stats[3] / total);

    JFreeChart chart = ChartFactory.createPieChart(null, dataset, false, false, false);

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setInteriorGap(0.0);//from ww  w .  j av a 2  s.co  m
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} ({2})"));
    plot.setLabelFont(getFont());

    return chart;
}

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

private static JFreeChart createChart() {
    CombinedDomainXYPlot combineddomainxyplot = new CombinedDomainXYPlot(new DateAxis("Date/Time"));
    combineddomainxyplot.setDomainPannable(true);
    combineddomainxyplot.add(createSubplot1(createDataset1()));
    combineddomainxyplot.add(createSubplot2(createDataset2()));
    JFreeChart jfreechart = new JFreeChart("XYTaskDatasetDemo2", combineddomainxyplot);
    jfreechart.setBackgroundPaint(Color.white);
    ChartUtilities.applyCurrentTheme(jfreechart);
    return jfreechart;
}

From source file:org.matsim.contrib.dvrp.util.chart.RouteCharts.java

public static JFreeChart chartRoutes(Collection<? extends Vehicle> vehicles) {
    CoordDataset lData = new CoordDataset();
    int i = 0;//from   ww  w  .ja v a 2  s .  c o  m
    for (Vehicle v : vehicles) {
        Schedule schedule = v.getSchedule();
        lData.addSeries(Integer.toString(i++), ScheduleCoordSources.createCoordSource(schedule));
    }

    JFreeChart chart = ChartFactory.createXYLineChart("Routes", "X", "Y", lData, PlotOrientation.VERTICAL, true,
            true, false);

    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRangeGridlinesVisible(false);
    plot.setDomainGridlinesVisible(false);
    plot.setBackgroundPaint(Color.white);

    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setAutoRangeIncludesZero(false);

    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setSeriesShapesVisible(0, true);
    renderer.setSeriesLinesVisible(0, false);
    renderer.setSeriesItemLabelsVisible(0, true);

    renderer.setBaseItemLabelGenerator(new XYItemLabelGenerator() {
        public String generateLabel(XYDataset dataset, int series, int item) {
            return ((CoordDataset) dataset).getText(series, item);
        }
    });

    for (int j = 1; j <= vehicles.size(); j++) {
        renderer.setSeriesShapesVisible(j, true);
        renderer.setSeriesLinesVisible(j, true);
        renderer.setSeriesItemLabelsVisible(j, true);
    }

    return chart;
}

From source file:cit.workflow.engine.manager.test.SWTTimeSeriesDemo.java

/**
 * Creates a chart./*from   w w  w.  j  a va  2  s  .c o  m*/
 * 
 * @param dataset  a dataset.
 * 
 * @return A chart.
 */
private static JFreeChart createChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createTimeSeriesChart("Legal & General Unit Trust Prices", // title
            "Date", // x-axis label
            "Price Per Unit", // y-axis label
            dataset, // data
            true, // create legend?
            true, // generate tooltips?
            false // generate URLs?
    );

    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(true);
        renderer.setBaseShapesFilled(true);
    }

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

    return chart;

}

From source file:components.ScrollablePicture.java

public ScrollablePicture(ImageIcon i, int m) {
    super(i);//from   w  ww .  ja  va2 s . c o  m
    if (i == null) {
        missingPicture = true;
        setText("No picture found.");
        setHorizontalAlignment(CENTER);
        setOpaque(true);
        setBackground(Color.white);
    }
    maxUnitIncrement = m;

    //Let the user scroll by dragging to outside the window.
    setAutoscrolls(true); //enable synthetic drag events
    addMouseMotionListener(this); //handle mouse drags
}

From source file:FontHints.java

protected void paintComponent(Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    g2d.setColor(Color.WHITE);
    g2d.fillRect(0, 0, getWidth(), getHeight());
    g2d.setColor(Color.BLACK);//w  w w.j a  v a 2  s.  co  m

    g2d.drawString("Unhinted string", 10, 20);
    if (desktopHints != null) {
        g2d.addRenderingHints(desktopHints);
    }
    g2d.drawString("Desktop-hinted string", 10, 40);
}

From source file:com.pureinfo.srm.common.ImageHelper.java

private static Color getColor() {
    Color[] names = new Color[] { Color.WHITE, Color.RED, Color.GREEN, Color.BLUE, Color.CYAN,
            Color.DARK_GRAY };/*from www. j  a  v a 2s  .c  o  m*/
    return names[Math.abs(random.nextInt()) % names.length];
}

From source file:monitordispositivos.RecibirVotos.java

public void actualizarConteo() {
    /*/*from   ww w.java 2s .  c o m*/
    * Porcentaje
    */
    votos = votos + 1;
    lblvotos_totales.setText("" + votos);
    porcentaje = (votos * 100) / poblacion;
    if (porcentaje >= 100.0 || (porcentaje % 1) == 0)
        decimales = new DecimalFormat("0");
    else
        decimales = new DecimalFormat("0.00");
    lblporcentaje.setText("" + decimales.format(porcentaje) + "%");

    // Fuente de Datos
    data = new DefaultPieDataset();
    data.setValue("SI", votos);
    data.setValue("NO", poblacion - votos);
    // Creando el Grafico
    chart = ChartFactory.createPieChart("", data, false, false, false);
    chart.setBackgroundPaint(Color.white);

    plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(Color.white);
    plot.setLabelGenerator(null);
    plot.setOutlineVisible(false);
    plot.setSectionPaint("SI", new Color(0, 204, 0));
    plot.setSectionPaint("NO", new Color(218, 24, 24));

    // Crear el Panel del Grafico con ChartPanel
    chartPanel = new ChartPanel(chart);
    chartPanel.setEnabled(false);
    pnlgrafica.setLayout(new java.awt.BorderLayout());
    pnlgrafica.removeAll();
    pnlgrafica.add(chartPanel, BorderLayout.CENTER);
    pnlgrafica.validate();
}

From source file:monitor.processing.OLD.SoccerField.java

public void drawTree(BaseNode n, RealVector v) {

    Color c = Color.WHITE;

    if (n instanceof TransformNode) {
        v = ((TransformNode) n).getTrasformMatrix().operate(v);

        c = Color.ORANGE;/* w  w  w .j a  v a 2  s .c  om*/
    } else if (n instanceof StaticMesh) {
        StaticMesh sm = (StaticMesh) n;

        if (sm.isTransparent()) {
            c = Color.BLUE;
        } else if (sm.isVisible()) {
            //                System.out.println(n.getInfo());
            //                System.out.println(v);
            c = Color.RED;
            if (sm.getModel().contains("naohead") || sm.getModel().contains("naobody")) {
                c = Color.PINK;
            }
        } else {
            c = Color.CYAN;
        }

    } else if (n instanceof StaticMeshNode) {
        StaticMeshNode smn = (StaticMeshNode) n;

        if (smn.isTransparent()) {
            c = Color.GREEN;
            //                cameraSceneX = (float)v.getEntry(0);
            //                cameraSceneY = (float)v.getEntry(1);
            //                cameraSceneZ = (float)v.getEntry(2);
        } else if (smn.isVisible()) {
            c = Color.YELLOW;
        } else {
            c = Color.MAGENTA;
        }

    }

    pushMatrix();
    fill(100);

    //        c = Color.getHSBColor(n.getAddress()*0.05f, 1, 1);
    stroke(c.getRed(), c.getGreen(), c.getBlue());
    translate((float) (scale * v.getEntry(0)), (float) (-scale * v.getEntry(1)),
            (float) (scale * v.getEntry(2)));
    box(5);
    popMatrix();

    for (int a = n.getChildren().size() - 1; a >= 0; a--) {
        drawTree(((ArrayList<BaseNode>) n.getChildren()).get(a), v);
    }

}