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.googlecode.snoopycp.controller.DomainController.java

public Transformer<String, Paint> createFillTransformer() {
    return new Transformer<String, Paint>() {

        @Override//from ww  w.  j a v  a2s. com
        public Paint transform(String vertex) {

            if (domain.enviroment().get(vertex) == null) {
                return Color.GRAY;
            } else {
                Ice.Identity identity = domain.enviroment().get(vertex);
                String state = domain.cache(identity).get("state");

                if (state.equals("OnlineState")) {
                    return Color.YELLOW;
                } else if (state.equals("ActiveState")) {
                    return Color.RED;
                } else {
                    return Color.BLUE;
                }
            }

        }
    };
}

From source file:cl.almejo.vsim.gui.ColorScheme.java

public ColorScheme(String name) {
    _name = name;//from www .  j  a  va2 s.c  om
    _colors.put("background", Color.GRAY);
    _colors.put("bus-on", Color.RED);
    _colors.put("gates", Color.BLUE);
    _colors.put("ground", Color.GREEN);
    _colors.put("off", Color.BLACK);
    _colors.put("wires-on", Color.RED);
    _colors.put("signal", Color.RED);
    _colors.put("grid", Color.GRAY);
    _colors.put("label", Color.YELLOW);
}

From source file:dataminning2.KmeanGraphplot.java

protected void paintComponent(Graphics g) {
    super.paintComponent(g);

    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    int w = getWidth();
    int h = getHeight();
    // Draw ordinate.
    g2.draw(new Line2D.Double(PAD, PAD, PAD, h - PAD));
    // Draw abcissa.
    g2.draw(new Line2D.Double(PAD, h - PAD, w - PAD, h - PAD));
    double xInc = (double) (w - 2 * PAD) / (data.length - 1);
    double scale = (double) (h - 2 * PAD) / 88;
    // Mark data points.

    g2.setPaint(Color.red);/*from w w  w. j a v a  2s  . c  o  m*/

    for (int i = 0; i < cluster0.length; i++) {
        double x = PAD + i * dataX[i];
        double y = h - PAD - scale * dataY[i];
        g2.fill(new Ellipse2D.Double(x - 2, y - 2, 4, 4));
    }

    g2.setPaint(Color.BLUE);

    for (int i = 0; i < cluster1.length; i++) {
        double x = PAD + i * dataX[i];
        double y = h - PAD - scale * dataY[i];
        g2.fill(new Ellipse2D.Double(x - 2, y - 2, 4, 4));
    }
    g2.setPaint(Color.YELLOW);

    for (int i = 0; i < cluster2.length; i++) {
        double x = PAD + i * dataX[i];
        double y = h - PAD - scale * dataY[i];
        g2.fill(new Ellipse2D.Double(x - 2, y - 2, 4, 4));
    }
}

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

public static JPanel createDemoPanel() {
    JPanel jpanel = new JPanel(new GridLayout(2, 2));
    jpanel.setPreferredSize(new Dimension(800, 600));
    IntervalXYDataset intervalxydataset = createDataset();
    JFreeChart jfreechart = createChart("Vertical", intervalxydataset);
    XYPlot xyplot = (XYPlot) jfreechart.getPlot();
    XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer();
    xybarrenderer.setDrawBarOutline(false);
    xybarrenderer.setSeriesPaint(0, new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, Color.yellow));
    xybarrenderer.setSeriesPaint(1, new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, Color.green));
    xybarrenderer.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));
    ChartPanel chartpanel = new ChartPanel(jfreechart);
    jpanel.add(chartpanel);//from  w  ww . jav  a 2s.  c  o m
    JFreeChart jfreechart1 = createChart("Vertical / Inverted Axis", intervalxydataset);
    XYPlot xyplot1 = (XYPlot) jfreechart1.getPlot();
    XYBarRenderer xybarrenderer1 = (XYBarRenderer) xyplot1.getRenderer();
    xybarrenderer1.setDrawBarOutline(false);
    xybarrenderer1.setSeriesPaint(0, new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, Color.yellow));
    xybarrenderer1.setSeriesPaint(1, new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, Color.green));
    xybarrenderer1.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL));
    xyplot1.getDomainAxis().setInverted(true);
    ChartPanel chartpanel1 = new ChartPanel(jfreechart1);
    jpanel.add(chartpanel1);
    JFreeChart jfreechart2 = createChart("Horizontal", intervalxydataset);
    XYPlot xyplot2 = (XYPlot) jfreechart2.getPlot();
    xyplot2.setOrientation(PlotOrientation.HORIZONTAL);
    XYBarRenderer xybarrenderer2 = (XYBarRenderer) xyplot2.getRenderer();
    xybarrenderer2.setDrawBarOutline(false);
    xybarrenderer2.setSeriesPaint(0, new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, Color.yellow));
    xybarrenderer2.setSeriesPaint(1, new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, Color.green));
    xybarrenderer2.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL));
    ChartPanel chartpanel2 = new ChartPanel(jfreechart2);
    jpanel.add(chartpanel2);
    JFreeChart jfreechart3 = createChart("Horizontal / Inverted Axis", intervalxydataset);
    XYPlot xyplot3 = (XYPlot) jfreechart3.getPlot();
    xyplot3.setOrientation(PlotOrientation.HORIZONTAL);
    XYBarRenderer xybarrenderer3 = (XYBarRenderer) xyplot3.getRenderer();
    xybarrenderer3.setDrawBarOutline(false);
    xybarrenderer3.setSeriesPaint(0, new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, Color.yellow));
    xybarrenderer3.setSeriesPaint(1, new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, Color.green));
    xybarrenderer3.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_HORIZONTAL));
    xyplot3.getDomainAxis().setInverted(true);
    ChartPanel chartpanel3 = new ChartPanel(jfreechart3);
    jpanel.add(chartpanel3);
    return jpanel;
}

From source file:Main.java

public TestPane() {
    setLayout(new BorderLayout());
    JPanel searchPane = new JPanel();
    searchPane.add(new JLabel("Find: "));

    searchPane.add(findText);//from  ww w.j  ava2 s .  c  om

    add(searchPane, BorderLayout.NORTH);
    add(new JScrollPane(ta));

    try (BufferedReader reader = new BufferedReader(new FileReader(new File("c:/Java_Dev/run.bat")))) {
        ta.read(reader, "Text");
    } catch (Exception e) {
        e.printStackTrace();
    }
    ta.setCaretPosition(0);

    keyTimer = new Timer(250, new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            String find = findText.getText();
            Document document = ta.getDocument();
            try {
                for (int index = 0; index + find.length() < document.getLength(); index++) {
                    String match = document.getText(index, find.length());
                    if (find.equals(match)) {
                        DefaultHighlighter.DefaultHighlightPainter highlightPainter = new DefaultHighlighter.DefaultHighlightPainter(
                                Color.YELLOW);
                        ta.getHighlighter().addHighlight(index, index + find.length(), highlightPainter);
                    }
                }
            } catch (BadLocationException exp) {
                exp.printStackTrace();
            }
        }
    });
    keyTimer.setRepeats(false);

    findText.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void insertUpdate(DocumentEvent e) {
            keyTimer.restart();
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            keyTimer.restart();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            keyTimer.restart();
        }
    });
}

From source file:components.CrayonPanel.java

public void updateChooser() {
    Color color = getColorFromModel();
    if (Color.red.equals(color)) {
        redCrayon.setSelected(true);/*www.  j  a va 2  s . co  m*/
    } else if (Color.yellow.equals(color)) {
        yellowCrayon.setSelected(true);
    } else if (Color.green.equals(color)) {
        greenCrayon.setSelected(true);
    } else if (Color.blue.equals(color)) {
        blueCrayon.setSelected(true);
    }
}

From source file:net.sf.statcvs.output.xml.chart.AuthorsActivityChart.java

public AuthorsActivityChart(CvsContent content) {
    super("activity.png", "Author Activity");

    setCategoryAxisLabel("");
    setValueAxisLabel("%");
    CategoryPlot plot = getChart().getCategoryPlot();
    plot.getRenderer().setSeriesPaint(REMOVING, Color.red);
    plot.getRenderer().setSeriesPaint(CHANGING, Color.yellow);
    plot.getRenderer().setSeriesPaint(ADDING, Color.green);
    plot.getDomainAxis().setVerticalCategoryLabels(true);

    Collection auts = content.getAuthors();
    Iterator it = auts.iterator();
    while (it.hasNext()) {
        Author author = (Author) it.next();
        authors.add(author.getName());//from   ww w  . j ava  2  s  .co  m
    }
    Collections.sort(authors);
    double[][] categories;
    categories = new double[3][authors.size()];
    for (int j = 0; j < authors.size(); j++) {
        categories[REMOVING][j] = 0;
        categories[CHANGING][j] = 0;
        categories[ADDING][j] = 0;
    }

    RevisionIterator revIt = content.getRevisionIterator();
    CommitListBuilder commitList = new CommitListBuilder(revIt);
    List commits = commitList.createCommitList();
    Iterator commitIt = commits.iterator();
    while (commitIt.hasNext()) {
        Commit commit = (Commit) commitIt.next();
        List commitRevList = commit.getRevisions();
        Iterator commitRevIt = commitRevList.iterator();
        int author = authors.indexOf(commit.getAuthor().getName());
        int linesAdded = 0;
        int linesRemoved = 0;
        while (commitRevIt.hasNext()) {
            CvsRevision revision = (CvsRevision) commitRevIt.next();
            linesAdded += revision.getLineValue();
            linesRemoved += revision.getRemovingValue();
        }
        if (linesAdded == linesRemoved) {
            categories[CHANGING][author] += linesAdded;
        }
        if (linesAdded < linesRemoved) {
            categories[CHANGING][author] += linesAdded;
            categories[REMOVING][author] += linesRemoved - linesAdded;
        }
        if (linesAdded > linesRemoved) {
            categories[ADDING][author] += linesAdded - linesRemoved;
            categories[CHANGING][author] += linesRemoved;
        }
    }

    for (int i = 0; i < authors.size(); i++) {
        double maxLines = categories[REMOVING][i] + categories[CHANGING][i] + categories[ADDING][i];
        for (int k = 0; k < 3; k++) {
            categories[k][i] *= (100 / maxLines);
            dataset.addValue(categories[k][i], topics[k], (String) authors.get(i));
        }
    }
    placeTitle();
}

From source file:components.ColorChooserDemo2.java

public ColorChooserDemo2() {
    super(new BorderLayout());

    //Set up banner to use as custom preview panel
    banner = new JLabel("Welcome to the Tutorial Zone!", JLabel.CENTER);
    banner.setForeground(Color.yellow);
    banner.setBackground(Color.blue);
    banner.setOpaque(true);/*w  w w .  j  a v a 2s  .c  o m*/
    banner.setFont(new Font("SansSerif", Font.BOLD, 24));
    banner.setPreferredSize(new Dimension(100, 65));

    JPanel bannerPanel = new JPanel(new BorderLayout());
    bannerPanel.add(banner, BorderLayout.CENTER);
    bannerPanel.setBorder(BorderFactory.createTitledBorder("Banner"));

    //Set up color chooser for setting background color
    JPanel panel = new JPanel(); //use FlowLayout
    JButton bcc = new JButton("Show Color Chooser...");
    bcc.addActionListener(this);
    panel.add(bcc);
    panel.setBorder(BorderFactory.createTitledBorder("Choose Background Color"));

    //Set up color chooser for setting text color
    tcc = new JColorChooser();
    tcc.getSelectionModel().addChangeListener(this);
    tcc.setBorder(BorderFactory.createTitledBorder("Choose Text Color"));

    //Remove the preview panel
    tcc.setPreviewPanel(new JPanel());

    //Override the chooser panels with our own
    AbstractColorChooserPanel panels[] = { new CrayonPanel() };
    tcc.setChooserPanels(panels);
    tcc.setColor(banner.getForeground());

    add(bannerPanel, BorderLayout.PAGE_START);
    add(panel, BorderLayout.CENTER);
    add(tcc, BorderLayout.PAGE_END);
}

From source file:de.tor.tribes.ui.renderer.ColoredCoutdownCellRenderer.java

@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    try {//  w w w .  ja va 2 s  .co  m
        JLabel renderComponent = ((JLabel) c);
        Long d = (Long) value;

        // renderComponent.setText(DurationFormatUtils.formatDuration(d, "HHH:mm:ss.SSS", true));

        long diff = d;
        long five_minutes = 5 * MINUTE;
        long ten_minutes = 10 * MINUTE;
        Color color = null;
        if (row % 2 == 0) {
            color = Constants.DS_ROW_A;
        } else {
            color = Constants.DS_ROW_B;
        }

        if (diff <= 0) {
            //value is expired, stroke result
            //renderComponent.setText(specialFormat.format(d));
            //renderComponent.setForeground(Color.RED);
        } else if (diff <= ten_minutes && diff > five_minutes) {
            float ratio = (float) (diff - five_minutes) / (float) five_minutes;
            Color c1 = Color.YELLOW;
            Color c2 = Color.GREEN;
            int red = (int) (c2.getRed() * ratio + c1.getRed() * (1 - ratio));
            int green = (int) (c2.getGreen() * ratio + c1.getGreen() * (1 - ratio));
            int blue = (int) (c2.getBlue() * ratio + c1.getBlue() * (1 - ratio));
            color = new Color(red, green, blue);
        } else if (diff <= five_minutes) {
            float ratio = (float) diff / (float) five_minutes;
            Color c1 = Color.RED;
            Color c2 = Color.YELLOW;
            int red = (int) (c2.getRed() * ratio + c1.getRed() * (1 - ratio));
            int green = (int) (c2.getGreen() * ratio + c1.getGreen() * (1 - ratio));
            int blue = (int) (c2.getBlue() * ratio + c1.getBlue() * (1 - ratio));
            color = new Color(red, green, blue);
        }
        renderComponent.setText(DurationFormatUtils.formatDuration(d, "HHH:mm:ss.SSS", true));
        if (isSelected) {
            color = c.getBackground();
        }
        renderComponent.setOpaque(true);
        renderComponent.setBackground(color);
        return renderComponent;
    } catch (Exception e) {
        return c;
    }
}

From source file:ch.epfl.lis.gnwgui.jungtransformers.EdgeFillColorTransformer.java

/**
 * Constructor
 * @param pi
 */
public EdgeFillColorTransformer(PickedInfo<E> pi) {
    pi_ = pi;
    defaultEdgeColor = Color.RED;
    pickedColor_ = Color.YELLOW;
}