Example usage for java.awt Color BLACK

List of usage examples for java.awt Color BLACK

Introduction

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

Prototype

Color BLACK

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

Click Source Link

Document

The color black.

Usage

From source file:Main.java

public void paint(Graphics g) {
    int fontSize = 20;

    g.setFont(new Font("TimesRoman", Font.BOLD, fontSize));

    String s = "www.java2s.com";

    g.setColor(Color.black);
    g.drawString(s, 30, 30);//  w  ww  . ja v  a 2s  . c  o  m
}

From source file:Main.java

public void paint(Graphics g) {
    int fontSize = 20;

    g.setFont(new Font("TimesRoman", Font.PLAIN, fontSize));

    String s = "www.java2s.com";

    g.setColor(Color.black);
    g.drawString(s, 30, 30);//from w  w  w  . ja  v  a  2s  . c o  m
}

From source file:Main.java

public void paint(Graphics g) {
    int fontSize = 20;

    g.setFont(new Font("TimesRoman", Font.ITALIC, fontSize));

    String s = "www.java2s.com";

    g.setColor(Color.black);
    g.drawString(s, 30, 30);/*from  www . jav a 2  s .  c om*/
}

From source file:MainClass.java

public void init() {
    int blackInt = Color.black.getRGB();
    int pix[] = new int[100 * 100];
    int n = 0;//from   ww  w. j  a v  a 2  s .c  om
    for (int i = 0; i < 100; i++) {
        for (int j = 0; j < 100; j++) {
            pix[n] = blackInt;
            n++;
        }
    }
    image = createImage(new MyImageSource(100, 100, pix));
}

From source file:GradientsLine.java

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;

    GradientPaint gp1 = new GradientPaint(5, 25, Color.green, 2, 2, Color.black, true);

    g2d.setPaint(gp1);/* w w w .  ja v a 2s  . c om*/
    g2d.fillRect(20, 140, 300, 40);

}

From source file:GradientsMiddle.java

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;

    GradientPaint gp1 = new GradientPaint(0, 0, Color.orange, 0, 20, Color.black, true);

    g2d.setPaint(gp1);/*from   w w  w .  j  a  v a 2s.com*/
    g2d.fillRect(20, 260, 300, 40);

}

From source file:GradientsVertical.java

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;

    GradientPaint gp1 = new GradientPaint(25, 25, Color.blue, 15, 25, Color.black, true);

    g2d.setPaint(gp1);//w  w  w  . j  av a2s .  com
    g2d.fillRect(20, 200, 300, 40);

}

From source file:GradientsDirection.java

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;

    GradientPaint gp1 = new GradientPaint(5, 25, Color.yellow, 20, 2, Color.black, true);

    g2d.setPaint(gp1);//from   ww  w .ja  v a 2 s  .  c o m
    g2d.fillRect(20, 80, 300, 40);

}

From source file:Main.java

public void paint(Graphics g) {
    int fontSize = 20;
    Font font = new Font("TimesRoman", Font.PLAIN, fontSize);
    g.setFont(font);//w  ww.j av  a 2s  . c  o  m

    font.canDisplay('A');

    String s = "www.java2s.com";

    g.setColor(Color.black);
    g.drawString(s, 30, 30);
}

From source file:Main.java

public static void draw(BufferedImage imageBG, BufferedImage imageFG) {
    Ellipse2D.Double ellipse1 = new Ellipse2D.Double(20, 20, 30, 30);
    Ellipse2D.Double ellipse2 = new Ellipse2D.Double(25, 25, 30, 30);
    Area circle = new Area(ellipse1);
    circle.subtract(new Area(ellipse2));

    Graphics2D g = imageBG.createGraphics();
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
    g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
    g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
    g.setClip(circle);//from w ww .jav a  2  s.  co  m
    g.drawImage(imageFG, 0, 0, null);
    g.setClip(null);
    Stroke s = new BasicStroke(2);
    g.setStroke(s);
    g.setColor(Color.BLACK);
    g.draw(circle);
    g.dispose();

    JLabel l = new JLabel(new ImageIcon(imageBG));
    JOptionPane.showMessageDialog(null, l);
}