Example usage for java.awt BasicStroke CAP_BUTT

List of usage examples for java.awt BasicStroke CAP_BUTT

Introduction

In this page you can find the example usage for java.awt BasicStroke CAP_BUTT.

Prototype

int CAP_BUTT

To view the source code for java.awt BasicStroke CAP_BUTT.

Click Source Link

Document

Ends unclosed subpaths and dash segments with no added decoration.

Usage

From source file:Main.java

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

    g2.setPaint(Color.black);/*www . j av  a  2s .c  o m*/
    g2.setStroke(new BasicStroke(8, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
    g2.draw(new Ellipse2D.Double(20, 20, 50, 50));
}

From source file:Main.java

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

    Stroke stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 3, 1 },
            0);//w w  w. j av a 2s  . c o m
    g2.setStroke(stroke);

    g2.setPaint(Color.black);
    g2.draw(new Rectangle2D.Float(10, 20, 30, 40));
}

From source file:Main.java

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

    Stroke stroke = new BasicStroke(10, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0.1F);
    g2.setStroke(stroke);//from   w ww . ja  v a2  s  .c om

    g2.setPaint(Color.black);
    g2.draw(new Rectangle2D.Float(10, 10, 200, 200));
}

From source file:Main.java

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

    Stroke stroke = new BasicStroke(10, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 3, 1 },
            0);/*from w  w w  . j a  va 2 s  .c  o  m*/
    g2.setStroke(stroke);

    g2.setPaint(Color.black);
    g2.draw(new Rectangle2D.Float(10, 10, 200, 200));
}

From source file:Main.java

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

    BasicStroke stroke = new BasicStroke(10, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0.1F);

    g2.setPaint(Color.black);//from  ww  w. ja  v  a 2 s.  c  o  m
    g2.draw(stroke.createStrokedShape(new Rectangle2D.Float(10, 10, 20, 20)));
}

From source file:LinesDashes3.java

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

    float[] dash3 = { 4f, 0f, 2f };

    BasicStroke bs3 = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1.0f, dash3, 2f);

    g2d.setStroke(bs3);/*from w  w w  . j av  a 2 s . c om*/
    g2d.drawLine(20, 60, 250, 60);
}

From source file:LinesDashes4.java

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

    float[] dash4 = { 4f, 4f, 1f };

    BasicStroke bs4 = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1.0f, dash4, 2f);

    g2d.setStroke(bs4);//from w w  w .j  a v  a  2  s .com
    g2d.drawLine(20, 20, 250, 20);
}

From source file:LinesDashes2.java

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

    Graphics2D g2d = (Graphics2D) g;
    g2d.drawLine(20, 40, 250, 40);/*from   ww w. ja  va2 s  .  co  m*/
    float[] dash2 = { 1f, 1f, 1f };

    BasicStroke bs2 = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1.0f, dash2, 2f);
    g2d.setStroke(bs2);
    g2d.drawLine(20, 20, 250, 20);
}

From source file:LinesDashes1.java

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

    Graphics2D g2d = (Graphics2D) g;

    float[] dash1 = { 2f, 0f, 2f };

    g2d.drawLine(20, 40, 250, 40);//from  w  ww .  ja  v  a  2  s . c  om

    BasicStroke bs1 = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1.0f, dash1, 2f);
    g2d.setStroke(bs1);
    g2d.drawLine(20, 80, 250, 80);

}

From source file:LinesDashes1.java

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

    Graphics2D g2d = (Graphics2D) g;

    float[] dash1 = { 2f, 0f, 2f };

    g2d.drawLine(20, 40, 250, 40);//from   w ww. ja  v a 2  s .com

    BasicStroke bs1 = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1.0f, dash1, 2f);
    //BasicStroke bs2 = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1.0f, dash2,2f);
    //float[] dash3 = { 4f, 0f, 2f };
    //BasicStroke bs3 = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1.0f, dash3,2f);

    //float[] dash4 = { 4f, 4f, 1f };
    //BasicStroke bs4 = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1.0f, dash4,2f);

    g2d.setStroke(bs1);
    g2d.drawLine(20, 80, 250, 80);

}