Example usage for java.awt Color blue

List of usage examples for java.awt Color blue

Introduction

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

Prototype

Color blue

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

Click Source Link

Document

The color blue.

Usage

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);//from   ww  w  .  j  a  va  2s .  co  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:Hypnosis1.java

public Hypnosis1(int numberOfSegments) {
    int numberOfCoordinates = numberOfSegments * 4 + 2;
    coordinates = new int[numberOfCoordinates];
    deltas = new int[numberOfCoordinates];
    for (int i = 0; i < numberOfCoordinates; i++) {
        coordinates[i] = (int) (Math.random() * 300);
        deltas[i] = (int) (Math.random() * 4 + 3);
        if (deltas[i] > 4)
            deltas[i] = -(deltas[i] - 3);
    }//w  ww .  jav a2  s  .  co  m
    paint = new GradientPaint(0, 0, Color.blue, 20, 10, Color.red, true);

    Thread t = new Thread(this);
    t.start();
}

From source file:Main.java

public void actionPerformed(ActionEvent evt) {
    Object source = evt.getSource();
    Color color = getBackground();
    if (source == yellowButton)
        color = Color.yellow;//from   w  w w .j  a v a 2 s . c o  m
    else if (source == blueButton)
        color = Color.blue;
    else if (source == redButton)
        color = Color.red;
    setBackground(color);
    repaint();
}

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]);/*  ww w  .j a  v  a  2s. c  o m*/
        }
    }
}

From source file:StringGraidentPaint.java

public void paint(Graphics g) {
    Graphics2D g2D = (Graphics2D) g;
    int w = getSize().width;
    int h = getSize().height;

    g2D.setFont(font);/*from   w  ww. j a  v  a  2  s .co m*/
    GradientPaint gp = new GradientPaint(30.0f, 50.0f, Color.blue, fontMetrics.stringWidth("Hello!"),
            fontMetrics.getHeight(), Color.red);
    g2D.setPaint(gp);
    g2D.drawString("Hello!", 20, 200);

}

From source file:MainClass.java

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

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

    Rectangle2D r = new Rectangle2D.Double(50, 50, 150, 100);
    g2.setPaint(Color.red);/*from   ww w.  j av  a2  s.c o  m*/
    g2.fill(r);

    Composite c = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, .4f);
    g2.setComposite(c);

    g2.setPaint(Color.blue);
    g2.setFont(new Font("Times New Roman", Font.PLAIN, 72));
    g2.drawString("www.java2s.com", 25, 130);
}

From source file:DoubleBufferWithBufferedImage.java

public void paint(Graphics g) {
    Graphics screengc = null;//w  ww  .j  av  a  2 s .c  o  m

    screengc = g;

    g = buffer.getGraphics();

    g.setColor(Color.blue);
    g.fillRect(0, 0, w, h);

    g.setColor(Color.red);
    for (int i = 0; i < w; i += gap)
        g.drawLine(i, 0, w - i, h);
    for (int i = 0; i < h; i += gap)
        g.drawLine(0, i, w, h - i);
    screengc.drawImage(buffer, 0, 0, null);
}

From source file:Main.java

public Main(String name) {
    getContentPane().setLayout(new FlowLayout());
    JLabel labelTwo = new JLabel("www.java2s.com");
    labelTwo.setBorder(BorderFactory.createEtchedBorder());

    add(labelTwo);//  w  w  w.j a va2  s  . c o m

    JLabel labelThree = new JLabel("MatteBorder");
    labelThree.setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink));
    add(labelThree);

    JLabel labelFour = new JLabel("TitledBorder");
    labelFour.setBorder(BorderFactory
            .createTitledBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, Color.pink), "Title"));
    add(labelFour);

    JLabel labelSix = new JLabel("CompoundBorder");
    Border one = BorderFactory.createEtchedBorder();
    Border two = BorderFactory.createMatteBorder(4, 4, 4, 4, Color.blue);
    labelSix.setBorder(BorderFactory.createCompoundBorder(one, two));
    add(labelSix);

}

From source file:GradientPaintDemo2D.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    g2.setPaint(Color.gray);/*w  w  w  . ja  va  2  s  . c  om*/
    int x = 5;
    int y = 7;
    // fill RoundRectangle2D.Double
    GradientPaint redtowhite = new GradientPaint(x, y, Color.red, 200, y, Color.blue);
    g2.setPaint(redtowhite);
    g2.fill(new RoundRectangle2D.Double(x, y, 200, 200, 10, 10));
    g2.setPaint(Color.black);
    g2.drawString("Filled RoundRectangle2D", x, 250);

}

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

private static JFreeChart createChart(XYZDataset xyzdataset) {
    DateAxis dateaxis = new DateAxis("Date");
    dateaxis.setLowerMargin(0.0D);// w  w  w .  j ava2s  . c o m
    dateaxis.setUpperMargin(0.0D);
    dateaxis.setInverted(true);
    NumberAxis numberaxis = new NumberAxis("Hour");
    numberaxis.setUpperMargin(0.0D);
    numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    XYBlockRenderer xyblockrenderer = new XYBlockRenderer();
    xyblockrenderer.setBlockWidth(86400000D);
    xyblockrenderer.setBlockAnchor(RectangleAnchor.BOTTOM_LEFT);
    LookupPaintScale lookuppaintscale = new LookupPaintScale(0.5D, 4.5D, Color.white);
    lookuppaintscale.add(0.5D, Color.red);
    lookuppaintscale.add(1.5D, Color.green);
    lookuppaintscale.add(2.5D, Color.blue);
    lookuppaintscale.add(3.5D, Color.yellow);
    xyblockrenderer.setPaintScale(lookuppaintscale);
    XYPlot xyplot = new XYPlot(xyzdataset, dateaxis, numberaxis, xyblockrenderer);
    xyplot.setOrientation(PlotOrientation.HORIZONTAL);
    xyplot.setBackgroundPaint(Color.lightGray);
    xyplot.setRangeGridlinePaint(Color.white);
    xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D));
    JFreeChart jfreechart = new JFreeChart("XYBlockChartDemo2", xyplot);
    jfreechart.removeLegend();
    jfreechart.setBackgroundPaint(Color.white);
    SymbolAxis symbolaxis = new SymbolAxis(null,
            new String[] { "", "Unavailable", "Free", "Group 1", "Group 2" });
    symbolaxis.setRange(0.5D, 4.5D);
    symbolaxis.setPlot(new PiePlot());
    symbolaxis.setGridBandsVisible(false);
    PaintScaleLegend paintscalelegend = new PaintScaleLegend(lookuppaintscale, symbolaxis);
    paintscalelegend.setMargin(new RectangleInsets(3D, 10D, 3D, 10D));
    paintscalelegend.setPosition(RectangleEdge.BOTTOM);
    paintscalelegend.setAxisOffset(5D);
    jfreechart.addSubtitle(paintscalelegend);
    return jfreechart;
}