Example usage for java.awt Color YELLOW

List of usage examples for java.awt Color YELLOW

Introduction

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

Prototype

Color YELLOW

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

Click Source Link

Document

The color yellow.

Usage

From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java

/**
 * Creates an area chart./*from w w w.j a  va 2 s . c o  m*/
 * 
 * @param title
 * @param categoryAxisLabel
 *            (X-Axis label)
 * @param valueAxisLabel
 *            (Y-Axis label)
 * @param dataset
 * @return JfreeChart instance.
 */
public JFreeChart createAreaChart(String title, String categoryAxisLabel, String valueAxisLabel,
        CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createAreaChart(title, categoryAxisLabel, valueAxisLabel, dataset,
            this.orientation, this.drawLegend, false, false);
    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);
    chart.setAntiAlias(true);
    CategoryPlot plot = chart.getCategoryPlot();
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setLowerMargin(0);
    domainAxis.setUpperMargin(0);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
    AreaRenderer renderer = (AreaRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    renderer.setSeriesPaint(1, Color.red);
    renderer.setSeriesPaint(2, Color.green);
    renderer.setSeriesPaint(3, Color.darkGray);
    renderer.setSeriesPaint(4, Color.yellow);
    return chart;
}

From source file:edu.ucla.stat.SOCR.chart.demo.BarChartDemo9.java

/**
 * Creates a sample chart./*from   w w w  . j a  v a 2 s  . c o  m*/
 * 
 * @param dataset  the dataset.
 * 
 * @return a sample chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {

    JFreeChart chart = ChartFactory.createBarChart(chartTitle, // chart title
            domainLabel, // domain axis label
            rangeLabel, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // the plot orientation
            !legendPanelOn, // include legend
            true, false);

    TextTitle title = chart.getTitle();
    title.setBorder(0, 0, 1, 0);
    title.setBackgroundPaint(new GradientPaint(0f, 0f, Color.red, 350f, 0f, Color.white, true));
    title.setExpandToFitSpace(true);

    chart.setBackgroundPaint(new GradientPaint(0f, 0f, Color.yellow, 350f, 0f, Color.white, true));

    // get a reference to the plot for further customisation...
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setNoDataMessage("NO DATA!");
    plot.setBackgroundPaint(null);
    plot.setInsets(new RectangleInsets(10, 5, 5, 5));
    plot.setOutlinePaint(Color.black);
    plot.setRangeGridlinePaint(Color.gray);
    plot.setRangeGridlineStroke(new BasicStroke(1.0f));
    Paint[] colors = createPaint();
    CustomBarRenderer renderer = new CustomBarRenderer(colors);
    renderer.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_HORIZONTAL));
    plot.setRenderer(renderer);

    renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

    // change the margin at the top of the range axis...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    //   rangeAxis.setRange(0.0, 800.0);
    rangeAxis.setTickMarkPaint(Color.black);

    setCategorySummary(dataset);
    return chart;

}

From source file:edu.ucla.stat.SOCR.chart.demo.BarChartDemo3.java

/**
 * Creates a sample chart.//from   ww w  . jav  a2s. c o m
 * 
 * @param dataset  the dataset.
 * 
 * @return a sample chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {

    JFreeChart chart = ChartFactory.createBarChart(chartTitle, // chart title
            domainLabel, // domain axis label
            rangeLabel, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // the plot orientation
            !legendPanelOn, // include legend
            true, false);

    chart.setBackgroundPaint(Color.lightGray);

    // get a reference to the plot for further customisation...
    CategoryPlot plot = (CategoryPlot) chart.getPlot();
    plot.setNoDataMessage("NO DATA!");

    CategoryItemRenderer renderer = new CustomBarRenderer(new Paint[] { Color.red, Color.blue, Color.green,
            Color.yellow, Color.orange, Color.cyan, Color.magenta, Color.blue });
    renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    renderer.setBaseItemLabelsVisible(true);
    ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER,
            45.0);
    renderer.setBasePositiveItemLabelPosition(p);
    plot.setRenderer(renderer);

    CategoryMarker marker = new CategoryMarker("Category 3");
    marker.setLabel("Special");
    marker.setPaint(new Color(0xDD, 0xFF, 0xDD, 0x80));
    marker.setAlpha(0.5f);
    marker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
    marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);
    marker.setLabelOffsetType(LengthAdjustmentType.CONTRACT);
    plot.addDomainMarker(marker, Layer.BACKGROUND);

    // change the margin at the top of the range axis...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setLowerMargin(0.15);
    rangeAxis.setUpperMargin(0.15);

    BarRenderer seriesRenderer = (BarRenderer) plot.getRenderer();
    seriesRenderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

    setCategorySummary(dataset);
    return chart;

}

From source file:userInterface.MonitoringTeamRole.DashBoarJPanel.java

private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel3MouseClicked
    // TODO add your handling code here:

    JFreeChart chart1 = createChart1(createDataset1());
    chart1.setBackgroundPaint(Color.YELLOW);
    chart1.getTitle().setPaint(Color.red);

    ChartFrame frame = new ChartFrame("XYChart", chart1);
    frame.setVisible(true);/*from w  w  w .j  av a2s .c o m*/
    frame.setSize(450, 500);
}

From source file:RobotTest.java

public ButtonPanel() {
    // create buttons

    JButton yellowButton = new JButton("Yellow");
    JButton blueButton = new JButton("Blue");
    JButton redButton = new JButton("Red");

    // add buttons to panel

    add(yellowButton);//from   www .j  av  a 2  s . c  om
    add(blueButton);
    add(redButton);

    // create button actions

    ColorAction yellowAction = new ColorAction(Color.YELLOW);
    ColorAction blueAction = new ColorAction(Color.BLUE);
    ColorAction redAction = new ColorAction(Color.RED);

    // associate actions with buttons

    yellowButton.addActionListener(yellowAction);
    blueButton.addActionListener(blueAction);
    redButton.addActionListener(redAction);
}

From source file:com.att.aro.ui.view.diagnostictab.plot.GpsPlot.java

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    if (analysis == null) {
        logger.info("analysis data is null");
        return;/* www  .  j  a va2s  .com*/
    }

    gpsData.removeAllSeries();
    locationData.removeAllSeries();

    TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
    if (resultType.equals(TraceResultType.TRACE_FILE)) {
        logger.info("didn't get analysis trace data!");

    } else {

        try {
            image = ImageIO.read(GpsPlot.class.getResourceAsStream("/images/location.png"));
            image = ImageHelper.resize(image, 12, 12);
        } catch (IOException e) {
            e.printStackTrace();
        }

        // create the GPS dataset...
        Map<GpsState, XYIntervalSeries> seriesMap = new EnumMap<GpsState, XYIntervalSeries>(GpsState.class);
        for (GpsState eventType : GpsState.values()) {
            XYIntervalSeries series = new XYIntervalSeries(eventType);
            seriesMap.put(eventType, series);
            gpsData.addSeries(series);
        }

        series = new XYSeries("location");
        TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult().getTraceresult();
        listLocationEvent = (ArrayList<LocationEvent>) traceresult.getLocationEventInfos();
        for (int idx = 0; idx < listLocationEvent.size(); idx++) {
            series.add(listLocationEvent.get(idx).getTimeRecorded(), 0.5);
        }
        locationData.addSeries(series);

        Iterator<GpsInfo> iter = analysis.getAnalyzerResult().getTraceresult().getGpsInfos().iterator();
        if (iter.hasNext()) {
            while (iter.hasNext()) {
                GpsInfo gpsEvent = iter.next();
                if (gpsEvent.getGpsState() != GpsState.GPS_DISABLED) {
                    seriesMap.get(gpsEvent.getGpsState()).add(gpsEvent.getBeginTimeStamp(),
                            gpsEvent.getBeginTimeStamp(), gpsEvent.getEndTimeStamp(), 0.5, 0, 1);
                }
            }
        }

        XYItemRenderer renderer = plot.getRenderer(0);
        // 0 - is the default renderer from XYItem renderer.
        // Looks like renderer is using the index descending order, so setting the index of the GPS background as 2 & location information index as 1.
        if (renderer == null) {
            renderer = plot.getRenderer(2);
        }
        renderer.setSeriesPaint(gpsData.indexOf(GpsState.GPS_STANDBY), Color.YELLOW);
        renderer.setSeriesPaint(gpsData.indexOf(GpsState.GPS_ACTIVE), new Color(34, 177, 76));

        // Assign ToolTip to renderer
        renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {
            @Override
            public String generateToolTip(XYDataset dataset, int series, int item) {
                GpsState eventType = (GpsState) gpsData.getSeries(series).getKey();
                return MessageFormat.format(ResourceBundleHelper.getMessageString("gps.tooltip"),
                        dataset.getX(series, item), ResourceBundleHelper.getEnumString(eventType));
            }
        });
        plot.setRenderer(2, renderer);

        // Assign ToolTip to renderer
        LocationImageRenderer renderer_loc = new LocationImageRenderer();
        plot.setRenderer(1, renderer_loc);
        renderer_loc.setBaseToolTipGenerator(new XYToolTipGenerator() {
            @Override
            public String generateToolTip(XYDataset dataset, int series, int item) {
                // Update tooltip of location data
                LocationEvent event = listLocationEvent.get(item);
                StringBuffer displayInfo = new StringBuffer(
                        ResourceBundleHelper.getMessageString("location.tooltip.prefix"));
                displayInfo.append(
                        MessageFormat.format(ResourceBundleHelper.getMessageString("location.tooltip.content"),
                                event.getTimeRecorded(), event.getLatitude(), event.getLongitude(),
                                event.getProvider(), event.getLocality()));
                displayInfo.append(ResourceBundleHelper.getMessageString("location.tooltip.suffix"));

                return displayInfo.toString();
            }
        });
    }
    plot.setDataset(2, gpsData);
    plot.setDataset(1, locationData);
}

From source file:edu.jhuapl.graphs.jfreechart.TimeSeriesEffectsTest.java

private static void addPoint(Date d, List<TimePoint> points, Random r, String url, String tooltip) {
    double val = getNextRandomValue(r);
    Map<String, Object> md = new HashMap<String, Object>();
    if (val >= 10 && val < 15) {
        md.put(GraphSource.ITEM_COLOR, Color.YELLOW);
    } else if (val >= 10 && val < 20) {
        md.put(GraphSource.ITEM_COLOR, Color.RED);
    }/*w ww  . jav a2 s .  c o  m*/
    if (url != null) {
        md.put(GraphSource.ITEM_URL, url);
    }
    if (tooltip != null) {
        md.put(GraphSource.ITEM_TOOL_TIP, tooltip);
    }

    points.add(new TimePoint(d, val, md));
}

From source file:de.fub.maps.project.plugins.tasks.eval.OverviewChart.java

private void initRenderer(CategoryItemRenderer renderer) {
    Color[] colors = new Color[] { Color.red, Color.blue, Color.orange, Color.cyan, Color.yellow, Color.magenta,
            Color.green, Color.pink, Color.black, Color.gray };

    if (!this.roadNetworkStatisticsList.isEmpty()) {
        for (int i = 0; i < this.roadNetworkStatisticsList.size(); i++) {
            renderer.setSeriesPaint(i, colors[i % colors.length]);
        }/*w w w. ja v a2s  .com*/
    }
}

From source file:com.xilinx.kintex7.PowerDial.java

public void createDial() {
    plot = new MeterPlot();
    dset = new DefaultValueDataset(0);
    plot.setUnits("Watts");
    plot.setRange(new Range(1, 10));
    plot.addInterval(new MeterInterval("Acceptable", new Range(1.0, 6.0), Color.lightGray,
            new BasicStroke(2.0f), Color.GREEN));
    plot.addInterval(new MeterInterval("Warning", new Range(6.0, 8.0), Color.lightGray, new BasicStroke(2.0f),
            Color.YELLOW));
    plot.addInterval(new MeterInterval("Dangerous", new Range(8.0, 10.0), Color.lightGray,
            new BasicStroke(2.0f), Color.RED));

    //sets different marks
    for (int i = 0; i < 10; i += 1) {
        if (i == 0)
            plot.addInterval(/*  www .  j  a va  2  s  .c  o m*/
                    new MeterInterval("", new Range(1, 1), Color.lightGray, new BasicStroke(2.0f), null));
        else
            plot.addInterval(
                    new MeterInterval("", new Range(i, i), Color.lightGray, new BasicStroke(2.0f), null));
    }
    plot.setNeedlePaint(Color.darkGray);
    plot.setDialBackgroundPaint(Color.white);
    plot.setDialOutlinePaint(Color.gray);
    plot.setDialShape(DialShape.PIE);
    plot.setMeterAngle(180);
    plot.setTickLabelsVisible(true);
    plot.setTickLabelFont(new Font("Dialog", Font.BOLD, 10));
    plot.setTickLabelPaint(Color.DARK_GRAY);
    plot.setTickSize(10.0);
    plot.setTickPaint(Color.lightGray);
    plot.setValuePaint(Color.BLACK);
    plot.setDataset(dset);

    LegendItemCollection legendItemsOld = plot.getLegendItems();
    final LegendItemCollection legendItemsNew = new LegendItemCollection();

    for (int i = 0; i < 3; i++) {
        LegendItem item = legendItemsOld.get(i);
        item.setLabelPaint(Color.WHITE);
        legendItemsNew.add(item);
    }

    LegendItemSource source = new LegendItemSource() {
        LegendItemCollection lic = new LegendItemCollection();
        {
            lic.addAll(legendItemsNew);
        }

        @Override
        public LegendItemCollection getLegendItems() {
            return lic;
        }
    };

    chart = new JFreeChart(plot);
    chart.addLegend(new LegendTitle(source));
    chart.removeLegend();
    chart.setTitle("");
    //chart.setBackgroundPaint(new GradientPaint(0,0,new Color(139,137,137),0,height,Color.BLUE ));
    //
    chart.getTitle().setPaint(Color.white);
    plot.setValueFont(new Font("Dialog", Font.BOLD, 14));
    //chartpanel = new ChartPanel(chart);
}

From source file:org.cloudml.codecs.DrawnIconVertexDemo.java

public DrawnIconVertexDemo(final Deployment dm) {
    this.dmodel = dm;
    // create a simple graph for the demo
    graph = new DirectedSparseGraph<Vertex, Edge>();
    vv = new VisualizationViewer<Vertex, Edge>(new SpringLayout2<Vertex, Edge>(graph));

    vv.getRenderContext().setVertexLabelRenderer(new DefaultVertexLabelRenderer(Color.cyan));
    vv.getRenderContext().setEdgeLabelRenderer(new DefaultEdgeLabelRenderer(Color.cyan));

    vv.getRenderContext().setVertexIconTransformer(vertexColor);

    vv.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<Vertex>(vv.getPickedVertexState(), Color.white, Color.yellow));
    vv.getRenderContext().setEdgeDrawPaintTransformer(edgeColor);

    vv.setBackground(Color.white);

    // add my listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller<Vertex>());
}