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:Overlap.java

public void paint(Graphics g) {
    Graphics2D g2 = (Graphics2D) g;
    double x = 15, y = 50, w = 70, h = 70;
    Ellipse2D e = new Ellipse2D.Double(x, y, w, h);
    g2.setStroke(new BasicStroke(8));

    Color smokeyColor = new Color(128, 128, 128, 128);
    g2.setPaint(smokeyColor);// ww w  .  jav a2 s .co  m
    g2.fill(e);
    g2.draw(e);

    e.setFrame(x + 100, y, w, h);
    g2.setPaint(Color.black);
    g2.draw(e);
    g2.setPaint(Color.gray);
    g2.fill(e);

    e.setFrame(x + 200, y, w, h);
    g2.setPaint(Color.gray);
    g2.fill(e);
    g2.setPaint(Color.black);
    g2.draw(e);
}

From source file:Main.java

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

    Point2D.Float p1 = new Point2D.Float(150.f, 75.f);
    Point2D.Float p2 = new Point2D.Float(250.f, 75.f);
    float width = 300;
    float height = 50;
    GradientPaint g1 = new GradientPaint(p1, Color.WHITE, p2, Color.DARK_GRAY);
    Rectangle2D.Float rect1 = new Rectangle2D.Float(p1.x - 100, p1.y - 25, width, height);
    g2D.setPaint(g1);//from  ww w.j a  va 2s  .c  o m
    g2D.fill(rect1);
    g2D.setPaint(Color.BLACK);
    g2D.draw(rect1);
    g2D.draw(new Line2D.Float(p1, p2));
    g2D.drawString("Cyclic Gradient Paint", p1.x - 100, p1.y - 50);
    g2D.drawString("p1", p1.x - 20, p1.y);
    g2D.drawString("p2", p2.x + 10, p2.y);

    p1.setLocation(150, 200);
    p2.setLocation(250, 200);
    GradientPaint g2 = new GradientPaint(p1, Color.WHITE, p2, Color.DARK_GRAY, false);
    rect1.setRect(p1.x - 100, p1.y - 25, width, height);
    g2D.setPaint(g2);
    g2D.fill(rect1);
    g2D.setPaint(Color.BLACK);
    g2D.draw(rect1);
    g2D.draw(new Line2D.Float(p1, p2));
    g2D.drawString("Acyclic Gradient Paint", p1.x - 100, p1.y - 50);
    g2D.drawString("p1", p1.x - 20, p1.y);
    g2D.drawString("p2", p2.x + 10, p2.y);
}

From source file:MainClass.java

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

    g2.setPaint(Color.black);
    g2.draw(shape);
}

From source file:MainClass.java

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

    Point2D.Float p1 = new Point2D.Float(150.f, 75.f);
    Point2D.Float p2 = new Point2D.Float(250.f, 75.f);
    float width = 300;
    float height = 50;
    GradientPaint g1 = new GradientPaint(p1, Color.WHITE, p2, Color.DARK_GRAY, true);
    Rectangle2D.Float rect1 = new Rectangle2D.Float(p1.x - 100, p1.y - 25, width, height);
    g2D.setPaint(g1);//from  ww w  .  j  a  v  a2s. c o m
    g2D.fill(rect1);
    g2D.setPaint(Color.BLACK);
    g2D.draw(rect1);
    g2D.draw(new Line2D.Float(p1, p2));
    g2D.drawString("Cyclic Gradient Paint", p1.x - 100, p1.y - 50);
    g2D.drawString("p1", p1.x - 20, p1.y);
    g2D.drawString("p2", p2.x + 10, p2.y);

    p1.setLocation(150, 200);
    p2.setLocation(250, 200);
    GradientPaint g2 = new GradientPaint(p1, Color.WHITE, p2, Color.DARK_GRAY, false);
    rect1.setRect(p1.x - 100, p1.y - 25, width, height);
    g2D.setPaint(g2);
    g2D.fill(rect1);
    g2D.setPaint(Color.BLACK);
    g2D.draw(rect1);
    g2D.draw(new Line2D.Float(p1, p2));
    g2D.drawString("Acyclic Gradient Paint", p1.x - 100, p1.y - 50);
    g2D.drawString("p1", p1.x - 20, p1.y);
    g2D.drawString("p2", p2.x + 10, p2.y);
}

From source file:MainClass.java

public void paint(Graphics g) {

    Graphics2D g2 = (Graphics2D) g;

    RenderingHints rh = g2.getRenderingHints();
    rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHints(rh);/*from  w  w w  .  j a v a2s . c  o m*/

    int x = 40, y = 40;

    g.setColor(Color.red);
    g.fillOval(x, y, 50, 50);

    Composite old = g2.getComposite();

    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC));

    g.setColor(Color.green);
    g.fillOval(x + 30, y + 30, 30, 30);

    g2.setComposite(old);

    g.setColor(Color.black);
    g.drawString("AlphaComposite.SRC", x, y + 80);

}

From source file:MainClass.java

public void paint(Graphics g) {

    Graphics2D g2 = (Graphics2D) g;

    RenderingHints rh = g2.getRenderingHints();
    rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHints(rh);/* ww w .  ja v  a 2s  .  c  om*/

    int x = 40, y = 40;

    g.setColor(Color.red);
    g.fillOval(x, y, 50, 50);

    Composite old = g2.getComposite();

    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.CLEAR));

    g.setColor(Color.green);
    g.fillOval(x + 30, y + 30, 30, 30);

    g2.setComposite(old);

    g.setColor(Color.black);
    g.drawString("AlphaComposite.CLEAR", x, y + 80);

}

From source file:MainClass.java

public void paint(Graphics g) {

    Graphics2D g2 = (Graphics2D) g;

    RenderingHints rh = g2.getRenderingHints();
    rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHints(rh);//from   w ww .  j a  v  a2  s . c  om

    int x = 40, y = 40;

    g.setColor(Color.red);
    g.fillOval(x, y, 50, 50);

    Composite old = g2.getComposite();

    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_IN));

    g.setColor(Color.green);
    g.fillOval(x + 30, y + 30, 30, 30);

    g2.setComposite(old);

    g.setColor(Color.black);
    g.drawString("AlphaComposite.SRC_IN", x, y + 80);

}

From source file:MainClass.java

public void paint(Graphics g) {

    Graphics2D g2 = (Graphics2D) g;

    RenderingHints rh = g2.getRenderingHints();
    rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHints(rh);//from   www.j a v  a 2  s  .c  om

    int x = 40, y = 40;

    g.setColor(Color.red);
    g.fillOval(x, y, 50, 50);

    Composite old = g2.getComposite();

    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.DST_IN));

    g.setColor(Color.green);
    g.fillOval(x + 30, y + 30, 30, 30);

    g2.setComposite(old);

    g.setColor(Color.black);
    g.drawString("AlphaComposite.DST_IN", x, y + 80);

}

From source file:Main.java

public Console() {
    JTextArea textArea = new JTextArea(24, 80);
    textArea.setBackground(Color.BLACK);
    textArea.setForeground(Color.LIGHT_GRAY);
    textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
    System.setOut(new PrintStream(new OutputStream() {
        @Override//from   w ww . j a  va  2s .c o m
        public void write(int b) throws IOException {
            textArea.append(String.valueOf((char) b));
        }
    }));
    frame.add(textArea);
}

From source file:MainClass.java

public void paint(Graphics g) {

    Graphics2D g2 = (Graphics2D) g;

    RenderingHints rh = g2.getRenderingHints();
    rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHints(rh);//from   www  . j  a va 2s.  c  o  m

    int x = 40, y = 40;

    g.setColor(Color.red);
    g.fillOval(x, y, 50, 50);

    Composite old = g2.getComposite();

    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OUT));

    g.setColor(Color.green);
    g.fillOval(x + 30, y + 30, 30, 30);

    g2.setComposite(old);

    g.setColor(Color.black);
    g.drawString("AlphaComposite.SRC_OUT", x, y + 80);

}