Example usage for java.awt Color green

List of usage examples for java.awt Color green

Introduction

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

Prototype

Color green

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

Click Source Link

Document

The color green.

Usage

From source file:CardLayoutBehaviour.java

public CardLayoutBehaviour() {
    JPanel tab;/*from   w  ww  . java  2s  .co  m*/
    Container pane = getContentPane();
    layout = new CardLayout();
    pane.setLayout(layout);
    tab = new JPanel();
    tab.setBackground(Color.red);
    pane.add(tab, "Red Tab");
    tab = new JPanel();
    tab.setBackground(Color.green);
    pane.add(tab, "Green Tab");
    tab = new JPanel();
    tab.setBackground(Color.blue);
    pane.add(tab, "Blue Tab");
}

From source file:ihm.PaneTab.java

public PaneTab() {
    super();/*from   ww  w . j  a  v a 2  s .  c o  m*/
    //super.setPreferredSize(new Dimension(600,600));
    //mainActivity.setPreferredSize(new Dimension(600,600));
    mainActivity.setBackground(Color.GREEN);
    tabPane1 = new JPanel();
    tabPane2 = new JPanel();
    tabPane3 = new JPanel();
    tabPane1.setBackground(Color.BLUE);
    tabPane2.setBackground(Color.CYAN);
    tabPane3.setBackground(Color.MAGENTA);
    mainActivity.add(tabPane1);
    mainActivity.setTitleAt(0, "Ram");
    mainActivity.add(tabPane2);
    mainActivity.setTitleAt(1, "Rem");
    mainActivity.add(tabPane3);
    mainActivity.setTitleAt(2, "Emilia");
    DataList test = new DataList();
    //mainActivity.add("Ram",tabPane1);
    //mainActivity.add("Rem",tabPane2);
    //mainActivity.add("Emilia",tabPane3);

    super.add(mainActivity);
    super.setVisible(true);
}

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

private static JFreeChart createChart(XYZDataset xyzdataset) {
    NumberAxis numberaxis = new NumberAxis("X");
    numberaxis.setLowerMargin(0.0D);//from   w  w  w . j  a  va2s. c  o  m
    numberaxis.setUpperMargin(0.0D);
    NumberAxis numberaxis1 = new NumberAxis("Y");
    numberaxis1.setAutoRangeIncludesZero(false);
    numberaxis1.setInverted(true);
    numberaxis1.setLowerMargin(0.0D);
    numberaxis1.setUpperMargin(0.0D);
    numberaxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    XYBlockRenderer xyblockrenderer = new XYBlockRenderer();
    LookupPaintScale lookuppaintscale = new LookupPaintScale(0.5D, 3.5D, Color.black);
    lookuppaintscale.add(0.5D, Color.green);
    lookuppaintscale.add(1.5D, Color.orange);
    lookuppaintscale.add(2.5D, Color.red);
    xyblockrenderer.setPaintScale(lookuppaintscale);
    XYPlot xyplot = new XYPlot(xyzdataset, numberaxis, numberaxis1, xyblockrenderer);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setDomainGridlinePaint(Color.white);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setForegroundAlpha(0.66F);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    JFreeChart jfreechart = new JFreeChart("XYBlockChartDemo3", xyplot);
    jfreechart.removeLegend();
    jfreechart.setBackgroundPaint(Color.white);
    SymbolAxis symbolaxis = new SymbolAxis(null, new String[] { "", "OK", "Uncertain", "Bad" });
    symbolaxis.setRange(0.5D, 3.5D);
    symbolaxis.setPlot(new PiePlot());
    symbolaxis.setGridBandsVisible(false);
    PaintScaleLegend paintscalelegend = new PaintScaleLegend(lookuppaintscale, symbolaxis);
    paintscalelegend.setAxisOffset(5D);
    paintscalelegend.setPosition(RectangleEdge.BOTTOM);
    paintscalelegend.setMargin(new RectangleInsets(5D, 5D, 5D, 5D));
    jfreechart.addSubtitle(paintscalelegend);
    return jfreechart;
}

From source file:TimerChangeButtonBackground.java

public TimerChangeButtonBackground() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    getContentPane().add(button, "Center");
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            timer.stop();//from   w w  w . j a  va 2  s . c  om
            button.setBackground(Color.red);
        }
    });
    timer = new Timer(1000, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            button.setBackground(flag ? Color.green : Color.yellow);
            flag = !flag;
            repaint();
        }
    });
    timer.start();
    pack();
    setVisible(true);
}

From source file:EvenOddRenderer.java

public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    Component renderer = DEFAULT_RENDERER.getTableCellRendererComponent(table, value, isSelected, hasFocus, row,
            column);/* w ww  . j a  v a2s .c o  m*/
    Color foreground, background;
    if (isSelected) {
        foreground = Color.YELLOW;
        background = Color.GREEN;
    } else {
        if (row % 2 == 0) {
            foreground = Color.BLUE;
            background = Color.WHITE;
        } else {
            foreground = Color.WHITE;
            background = Color.BLUE;
        }
    }
    renderer.setForeground(foreground);
    renderer.setBackground(background);
    return renderer;
}

From source file:Main.java

public Main() {
    Image grass = createImage(Color.green);
    Image water = createImage(Color.blue);
    grassIcon = new ImageIcon(grass);
    waterIcon = new ImageIcon(water);

    setLayout(new GridLayout(labelGrid.length, labelGrid[0].length));
    for (int row = 0; row < labelGrid.length; row++) {
        for (int col = 0; col < labelGrid[row].length; col++) {
            ImageIcon icon = MAP_1_ST[row].charAt(col) == '0' ? grassIcon : waterIcon;
            labelGrid[row][col] = new JLabel(icon);
            add(labelGrid[row][col]);/*from w w w  . j  a  v a 2  s  .  co  m*/
        }
    }
}

From source file:XORModePaintWithMouse.java

public void paint(Graphics g) {
    g.drawLine(0, 0, 100, 100);//ww  w . j a va  2 s .c om
    g.drawLine(0, 100, 100, 0);
    g.setColor(Color.blue);
    g.drawLine(40, 25, 250, 180);
    g.drawLine(75, 90, 400, 400);
    g.setColor(Color.green);

    // xor cross hairs
    g.setXORMode(Color.black);
    g.drawLine(chsX - 10, chsY, chsX + 10, chsY);
    g.drawLine(chsX, chsY - 10, chsX, chsY + 10);
    g.setPaintMode();
}

From source file:Main.java

public Main() {
    UIManager.put("TabbedPane.contentBorderInsets", new InsetsUIResource(1, 0, 0, 0));
    UIManager.put("TabbedPane.contentAreaColor", new ColorUIResource(Color.GREEN));
    UIManager.put("TabbedPane.focus", new ColorUIResource(Color.ORANGE));
    UIManager.put("TabbedPane.selected", new ColorUIResource(Color.YELLOW));
    UIManager.put("TabbedPane.darkShadow", new ColorUIResource(Color.DARK_GRAY));
    UIManager.put("TabbedPane.borderHightlightColor", new ColorUIResource(Color.LIGHT_GRAY));
    UIManager.put("TabbedPane.light", new ColorUIResource(Color.WHITE));
    UIManager.put("TabbedPane.tabAreaBackground", new ColorUIResource(Color.CYAN));
    UIManager.put("ToolTip.background", Color.WHITE);
    UIManager.put("ToolTip.border", new BorderUIResource(new LineBorder(Color.BLACK)));
    this.updateUI();

    this.setBackground(Color.BLUE);

    JPanel testPanel = new JPanel();
    testPanel.setLayout(new BorderLayout());
    testPanel.add(new JLabel("Hello World"), BorderLayout.NORTH);
    testPanel.add(new JTextArea("Looks nice out there :)"), BorderLayout.CENTER);

    JPanel testPanel2 = new JPanel();
    testPanel2.setLayout(new BorderLayout());
    testPanel2.add(new JLabel("Good Bye World"), BorderLayout.NORTH);
    testPanel2.add(new JTextArea("OK"), BorderLayout.CENTER);

    this.addTab("Hello World", testPanel);
    this.addTab("World", testPanel2);
}

From source file:Main.java

@Override
protected void paintComponent(Graphics window) {
    super.paintComponent(window);
    Graphics2D twoDGraph = (Graphics2D) window;
    if (time % 2 == 0) {
        twoDGraph.setColor(Color.RED);
    } else {//from w w w.ja  va  2  s  .  c o m
        twoDGraph.setColor(Color.GREEN);
    }
    twoDGraph.fillOval(100, 100, 600, 600);
    time++;
}

From source file:ChartServlet.java

/** Draw a Graphical Chart in response to a user request */
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {

    response.setContentType("image/jpeg");

    // Create an Image
    BufferedImage img = new BufferedImage(W, H, BufferedImage.TYPE_INT_RGB);

    // Get the Image's Graphics, and draw.
    Graphics2D g = img.createGraphics();

    // In real life this would call some charting software...
    g.setColor(Color.white);/*  w w w  . j a  va  2s . c o  m*/
    g.fillRect(0, 0, W, H);
    g.setColor(Color.green);
    g.fillOval(100, 75, 50, 50);

    // Write the output
    OutputStream os = response.getOutputStream();
    ImageOutputStream ios = ImageIO.createImageOutputStream(os);

    if (!ImageIO.write(img, "jpeg", ios)) {
        log("Boo hoo, failed to write JPEG");
    }
    ios.close();
    os.close();
}