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:com.att.aro.ui.view.diagnostictab.plot.WifiPlot.java

@Override
public void populate(XYPlot plot, AROTraceData analysis) {
    wifiData = new XYIntervalSeriesCollection();

    if (analysis == null) {
        logger.info("didn't get analysis trace data!  ");
    } else {//  ww  w .  j a  va2  s  .  co m
        TraceResultType resultType = analysis.getAnalyzerResult().getTraceresult().getTraceResultType();
        if (resultType.equals(TraceResultType.TRACE_FILE)) {
            logger.info("it is not contain the file ");
        } else {
            TraceDirectoryResult traceresult = (TraceDirectoryResult) analysis.getAnalyzerResult()
                    .getTraceresult();

            Map<WifiState, XYIntervalSeries> seriesMap = new EnumMap<WifiState, XYIntervalSeries>(
                    WifiState.class);
            for (WifiState eventType : WifiState.values()) {
                XYIntervalSeries series = new XYIntervalSeries(eventType);
                seriesMap.put(eventType, series);
                switch (eventType) {
                case WIFI_UNKNOWN:
                case WIFI_DISABLED:
                    // Don't chart these
                    break;
                default:
                    wifiData.addSeries(series);
                    break;
                }
            }

            // Populate the data set
            List<WifiInfo> wifiInfos = traceresult.getWifiInfos();
            final Map<Double, WifiInfo> eventMap = new HashMap<Double, WifiInfo>(wifiInfos.size());
            Iterator<WifiInfo> iter = wifiInfos.iterator();
            if (iter.hasNext()) {
                while (iter.hasNext()) {
                    WifiInfo wifiEvent = iter.next();
                    seriesMap.get(wifiEvent.getWifiState()).add(wifiEvent.getBeginTimeStamp(),
                            wifiEvent.getBeginTimeStamp(), wifiEvent.getEndTimeStamp(), 0.5, 0, 1);
                    eventMap.put(wifiEvent.getBeginTimeStamp(), wifiEvent);
                }
            }

            XYItemRenderer renderer = plot.getRenderer();
            for (WifiState eventType : WifiState.values()) {
                Color paint;
                switch (eventType) {
                case WIFI_CONNECTED:
                case WIFI_CONNECTING:
                case WIFI_DISCONNECTING:
                    paint = new Color(34, 177, 76);
                    break;
                case WIFI_DISCONNECTED:
                case WIFI_SUSPENDED:
                    paint = Color.YELLOW;
                    break;
                default:
                    paint = Color.WHITE;
                    break;
                }

                int index = wifiData.indexOf(eventType);
                if (index >= 0) {
                    renderer.setSeriesPaint(index, paint);
                }
            }

            // Assign ToolTip to renderer
            renderer.setBaseToolTipGenerator(new XYToolTipGenerator() {
                @Override
                public String generateToolTip(XYDataset dataset, int series, int item) {
                    WifiState eventType = (WifiState) wifiData.getSeries(series).getKey();

                    StringBuffer message = new StringBuffer(
                            ResourceBundleHelper.getMessageString("wifi.tooltip.prefix"));
                    message.append(MessageFormat.format(ResourceBundleHelper.getMessageString("wifi.tooltip"),
                            dataset.getX(series, item), ResourceBundleHelper.getEnumString(eventType)));
                    switch (eventType) {
                    case WIFI_CONNECTED:
                        WifiInfo info = eventMap.get(dataset.getX(series, item));
                        if (info != null && info.getWifiState() == WifiState.WIFI_CONNECTED) {
                            message.append(MessageFormat.format(
                                    ResourceBundleHelper.getMessageString("wifi.connTooltip"),
                                    info.getWifiMacAddress(), info.getWifiRSSI(), info.getWifiSSID()));
                        }
                        break;
                    default:
                        break;
                    }
                    message.append(ResourceBundleHelper.getMessageString("wifi.tooltip.suffix"));
                    return message.toString();
                }
            });
        }
    }

    plot.setDataset(wifiData);
    //      return plot;
}

From source file:cl.apr.pdf.chart.BarChartAviso.java

public CustomRenderer() {
    this.colors = new Paint[] { Color.red, Color.blue, Color.green, Color.yellow, Color.orange, Color.cyan,
            Color.magenta, Color.blue };
}

From source file:st.jigasoft.dbutil.util.ReportTheme.java

private static Color colorItems(int i) {
    ReportTheme.MAX_COLUNS_COLOR = 5;/* w  w  w  . ja  va  2  s  .  c  om*/
    switch (i) {
    case 1:
        return Color.BLUE;
    case 2:
        return Color.RED;
    case 3:
        return Color.GREEN;
    default:
        return Color.YELLOW;
    }
}

From source file:userInterface.MonitoringTeamRole.DashBoarJPanel.java

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

    JFreeChart chart = createChart(createDataset());
    chart.setBackgroundPaint(Color.YELLOW);
    chart.getTitle().setPaint(Color.red);

    ChartFrame frame = new ChartFrame("XYChart", chart);
    frame.setVisible(true);/*  www  .  j av a  2s  . c o  m*/
    frame.setSize(450, 500);
}

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

/**
 * Creates a new demo.// ww w  .  j av a 2  s .  com
 *
 * @param title  the frame title.
 */
public MinMaxCategoryPlotDemo(final String title) {

    super(title);

    // create a dataset...
    final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(1.0, "First", "Category 1");
    dataset.addValue(4.0, "First", "Category 2");
    dataset.addValue(3.0, "First", "Category 3");
    dataset.addValue(5.0, "First", "Category 4");
    dataset.addValue(5.0, "First", "Category 5");
    dataset.addValue(7.0, "First", "Category 6");
    dataset.addValue(7.0, "First", "Category 7");
    dataset.addValue(8.0, "First", "Category 8");
    dataset.addValue(5.0, "Second", "Category 1");
    dataset.addValue(7.0, "Second", "Category 2");
    dataset.addValue(6.0, "Second", "Category 3");
    dataset.addValue(8.0, "Second", "Category 4");
    dataset.addValue(4.0, "Second", "Category 5");
    dataset.addValue(4.0, "Second", "Category 6");
    dataset.addValue(2.0, "Second", "Category 7");
    dataset.addValue(1.0, "Second", "Category 8");
    dataset.addValue(4.0, "Third", "Category 1");
    dataset.addValue(3.0, "Third", "Category 2");
    dataset.addValue(2.0, "Third", "Category 3");
    dataset.addValue(3.0, "Third", "Category 4");
    dataset.addValue(6.0, "Third", "Category 5");
    dataset.addValue(3.0, "Third", "Category 6");
    dataset.addValue(4.0, "Third", "Category 7");
    dataset.addValue(3.0, "Third", "Category 8");

    // create the chart...
    final JFreeChart chart = ChartFactory.createBarChart("Min/Max Category Plot", // chart title
            "Category", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, true, // include legend
            true, // tooltips
            false // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.yellow);

    // get a reference to the plot for further customisation...
    final CategoryPlot plot = chart.getCategoryPlot();
    plot.setRenderer(new MinMaxCategoryRenderer());
    // OPTIONAL CUSTOMISATION COMPLETED.

    // add the chart to a panel...
    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
    setContentPane(chartPanel);

}

From source file:SwingDnDTest.java

public static JTable table() {
    Object[][] cells = { { "Mercury", 2440.0, 0, false, Color.YELLOW },
            { "Venus", 6052.0, 0, false, Color.YELLOW }, { "Earth", 6378.0, 1, false, Color.BLUE },
            { "Mars", 3397.0, 2, false, Color.RED }, { "Jupiter", 71492.0, 16, true, Color.ORANGE },
            { "Saturn", 60268.0, 18, true, Color.ORANGE }, { "Uranus", 25559.0, 17, true, Color.BLUE },
            { "Neptune", 24766.0, 8, true, Color.BLUE }, { "Pluto", 1137.0, 1, false, Color.BLACK } };

    String[] columnNames = { "Planet", "Radius", "Moons", "Gaseous", "Color" };
    return new JTable(cells, columnNames);
}

From source file:EdgeLabelDemo.java

/**
 * create an instance of a simple graph with controls to
 * demo the label positioning features/* ww w.  ja  v  a 2 s  .  co m*/
 * 
 */
@SuppressWarnings("serial")
public EdgeLabelDemo() {

    // create a simple graph for the demo
    graph = new SparseMultigraph<Integer, Number>();
    Integer[] v = createVertices(3);
    createEdges(v);

    Layout<Integer, Number> layout = new CircleLayout<Integer, Number>(graph);
    vv = new VisualizationViewer<Integer, Number>(layout, new Dimension(600, 400));
    vv.setBackground(Color.white);

    vertexLabelRenderer = vv.getRenderContext().getVertexLabelRenderer();
    edgeLabelRenderer = vv.getRenderContext().getEdgeLabelRenderer();

    Transformer<Number, String> stringer = new Transformer<Number, String>() {
        public String transform(Number e) {
            return "Edge:" + graph.getEndpoints(e).toString();
        }
    };
    vv.getRenderContext().setEdgeLabelTransformer(stringer);
    vv.getRenderContext().setEdgeDrawPaintTransformer(
            new PickableEdgePaintTransformer<Number>(vv.getPickedEdgeState(), Color.black, Color.cyan));
    vv.getRenderContext().setVertexFillPaintTransformer(
            new PickableVertexPaintTransformer<Integer>(vv.getPickedVertexState(), Color.red, Color.yellow));
    // add my listener for ToolTips
    vv.setVertexToolTipTransformer(new ToStringLabeller<Integer>());

    // create a frome to hold the graph
    final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv);
    Container content = getContentPane();
    content.add(panel);

    final DefaultModalGraphMouse<Integer, Number> graphMouse = new DefaultModalGraphMouse<Integer, Number>();
    vv.setGraphMouse(graphMouse);

    JButton plus = new JButton("+");
    plus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1.1f, vv.getCenter());
        }
    });
    JButton minus = new JButton("-");
    minus.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            scaler.scale(vv, 1 / 1.1f, vv.getCenter());
        }
    });

    ButtonGroup radio = new ButtonGroup();
    JRadioButton lineButton = new JRadioButton("Line");
    lineButton.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<Integer, Number>());
                vv.repaint();
            }
        }
    });

    JRadioButton quadButton = new JRadioButton("QuadCurve");
    quadButton.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.QuadCurve<Integer, Number>());
                vv.repaint();
            }
        }
    });

    JRadioButton cubicButton = new JRadioButton("CubicCurve");
    cubicButton.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.CubicCurve<Integer, Number>());
                vv.repaint();
            }
        }
    });
    radio.add(lineButton);
    radio.add(quadButton);
    radio.add(cubicButton);

    graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING);

    JCheckBox rotate = new JCheckBox("<html><center>EdgeType<p>Parallel</center></html>");
    rotate.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            AbstractButton b = (AbstractButton) e.getSource();
            edgeLabelRenderer.setRotateEdgeLabels(b.isSelected());
            vv.repaint();
        }
    });
    rotate.setSelected(true);
    MutableDirectionalEdgeValue mv = new MutableDirectionalEdgeValue(.5, .7);
    vv.getRenderContext().setEdgeLabelClosenessTransformer(mv);
    JSlider directedSlider = new JSlider(mv.getDirectedModel()) {
        public Dimension getPreferredSize() {
            Dimension d = super.getPreferredSize();
            d.width /= 2;
            return d;
        }
    };
    JSlider undirectedSlider = new JSlider(mv.getUndirectedModel()) {
        public Dimension getPreferredSize() {
            Dimension d = super.getPreferredSize();
            d.width /= 2;
            return d;
        }
    };

    JSlider edgeOffsetSlider = new JSlider(0, 50) {
        public Dimension getPreferredSize() {
            Dimension d = super.getPreferredSize();
            d.width /= 2;
            return d;
        }
    };
    edgeOffsetSlider.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            JSlider s = (JSlider) e.getSource();
            AbstractEdgeShapeTransformer<Integer, Number> aesf = (AbstractEdgeShapeTransformer<Integer, Number>) vv
                    .getRenderContext().getEdgeShapeTransformer();
            aesf.setControlOffsetIncrement(s.getValue());
            vv.repaint();
        }

    });

    Box controls = Box.createHorizontalBox();

    JPanel zoomPanel = new JPanel(new GridLayout(0, 1));
    zoomPanel.setBorder(BorderFactory.createTitledBorder("Scale"));
    zoomPanel.add(plus);
    zoomPanel.add(minus);

    JPanel edgePanel = new JPanel(new GridLayout(0, 1));
    edgePanel.setBorder(BorderFactory.createTitledBorder("EdgeType Type"));
    edgePanel.add(lineButton);
    edgePanel.add(quadButton);
    edgePanel.add(cubicButton);

    JPanel rotatePanel = new JPanel();
    rotatePanel.setBorder(BorderFactory.createTitledBorder("Alignment"));
    rotatePanel.add(rotate);

    JPanel labelPanel = new JPanel(new BorderLayout());
    JPanel sliderPanel = new JPanel(new GridLayout(3, 1));
    JPanel sliderLabelPanel = new JPanel(new GridLayout(3, 1));
    JPanel offsetPanel = new JPanel(new BorderLayout());
    offsetPanel.setBorder(BorderFactory.createTitledBorder("Offset"));
    sliderPanel.add(directedSlider);
    sliderPanel.add(undirectedSlider);
    sliderPanel.add(edgeOffsetSlider);
    sliderLabelPanel.add(new JLabel("Directed", JLabel.RIGHT));
    sliderLabelPanel.add(new JLabel("Undirected", JLabel.RIGHT));
    sliderLabelPanel.add(new JLabel("Edges", JLabel.RIGHT));
    offsetPanel.add(sliderLabelPanel, BorderLayout.WEST);
    offsetPanel.add(sliderPanel);
    labelPanel.add(offsetPanel);
    labelPanel.add(rotatePanel, BorderLayout.WEST);

    JPanel modePanel = new JPanel(new GridLayout(2, 1));
    modePanel.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    modePanel.add(graphMouse.getModeComboBox());

    controls.add(zoomPanel);
    controls.add(edgePanel);
    controls.add(labelPanel);
    controls.add(modePanel);
    content.add(controls, BorderLayout.SOUTH);
    quadButton.setSelected(true);
}

From source file:charts.PieChart3D.java

/**
 * Creates a chart./*  w  w w. j a  v a2s . c  om*/
 *
 * @param dataset
 *            the dataset.
 *
 * @return A chart.
 */
private static JFreeChart createChart(PieDataset dataset, PieChartModel model) {

    JFreeChart chart = ChartFactory.createPieChart(model.getTitle(), // chart
            // title
            dataset, // data
            false, // no legend
            true, // tooltips
            false // no URL generation
    );

    // set a custom background for the chart
    chart.setBackgroundPaint(
            new GradientPaint(new Point(0, 0), new Color(20, 20, 20), new Point(400, 200), Color.DARK_GRAY));

    // customise the title position and font
    TextTitle t = chart.getTitle();
    t.setHorizontalAlignment(HorizontalAlignment.LEFT);
    t.setPaint(new Color(240, 240, 240));
    t.setFont(new Font("Arial", Font.BOLD, 26));

    PiePlot plot = (PiePlot) chart.getPlot();
    plot.setBackgroundPaint(null);
    plot.setInteriorGap(0.04);
    plot.setOutlineVisible(false);

    // use gradients and white borders for the section colours
    plot.setSectionPaint("FCA", createGradientPaint(new Color(200, 200, 255), Color.BLUE));
    plot.setSectionPaint("FCH", createGradientPaint(new Color(255, 200, 200), Color.RED));
    plot.setSectionPaint("FCS", createGradientPaint(new Color(200, 255, 200), Color.GREEN));
    plot.setSectionPaint("FCG", createGradientPaint(new Color(200, 255, 200), Color.YELLOW));
    plot.setSectionPaint("FCJ", createGradientPaint(new Color(200, 255, 200), Color.BLACK));
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0} {1} ({2}) "));
    plot.setBaseSectionOutlinePaint(Color.WHITE);
    plot.setSectionOutlinesVisible(true);
    plot.setBaseSectionOutlineStroke(new BasicStroke(2.0f));

    // customise the section label appearance
    plot.setLabelFont(new Font("Courier New", Font.BOLD, 20));
    plot.setLabelLinkPaint(Color.WHITE);
    plot.setLabelLinkStroke(new BasicStroke(2.0f));
    plot.setLabelOutlineStroke(null);
    plot.setLabelPaint(Color.WHITE);
    plot.setLabelBackgroundPaint(null);

    // add a subtitle giving the data source
    TextTitle source = new TextTitle(model.getSubTitle(), new Font("Courier New", Font.PLAIN, 12));
    source.setPaint(Color.WHITE);
    source.setPosition(RectangleEdge.BOTTOM);
    source.setHorizontalAlignment(HorizontalAlignment.RIGHT);
    chart.addSubtitle(source);
    return chart;

}

From source file:de.tor.tribes.ui.windows.ClockFrame.java

protected void updateTime(String time, int millis) {
    if (isVisible()) {
        jLabel1.setText(time);/* w w w . j a v a 2  s .c o  m*/
        double markerMin = 0;
        double markerMax = 1000;
        double diff = markerMax - markerMin;
        float ratio = 0;
        if (diff > 0) {
            ratio = (float) ((millis - markerMin) / (markerMax - markerMin));
        }

        Color c1 = Color.GREEN;
        if (millis >= 500) {
            c1 = Color.YELLOW;
        }
        Color c2 = Color.RED;
        if (millis < 500) {
            c2 = Color.YELLOW;
            ratio += .5f;
        } else {
            ratio -= .5f;
        }
        int red = (int) Math.rint(c2.getRed() * ratio + c1.getRed() * (1f - ratio));
        int green = (int) Math.rint(c2.getGreen() * ratio + c1.getGreen() * (1f - ratio));
        int blue = (int) Math.rint(c2.getBlue() * ratio + c1.getBlue() * (1f - ratio));

        red = (red < 0) ? 0 : red;
        green = (green < 0) ? 0 : green;
        blue = (blue < 0) ? 0 : blue;
        red = (red > 255) ? 255 : red;
        green = (green > 255) ? 255 : green;
        blue = (blue > 255) ? 255 : blue;
        cp.setForeground(new Color(red, green, blue));
        cp.setValue(millis);
    }

    for (final TimerPanel p : timers.toArray(new TimerPanel[timers.size()])) {
        if (p.isExpired()) {
            SystrayHelper.showInfoMessage("Timer  '" + p.getName() + "' ist abgelaufen");
            //moved playing the sound to a new Thread because of graphic problems
            new Thread(new Runnable() {
                @Override
                public void run() {
                    playSound(p.getSound());
                }
            }).start();
            removeTimer(p);
        } else {
            p.update();
        }
    }
}

From source file:components.CrayonPanel.java

public void actionPerformed(ActionEvent e) {
    Color newColor = null;/*from  w  w  w.  jav  a  2  s  .  c  om*/
    String command = ((JToggleButton) e.getSource()).getActionCommand();
    if ("green".equals(command))
        newColor = Color.green;
    else if ("red".equals(command))
        newColor = Color.red;
    else if ("yellow".equals(command))
        newColor = Color.yellow;
    else if ("blue".equals(command))
        newColor = Color.blue;
    getColorSelectionModel().setSelectedColor(newColor);
}