Example usage for javax.swing BorderFactory createDashedBorder

List of usage examples for javax.swing BorderFactory createDashedBorder

Introduction

In this page you can find the example usage for javax.swing BorderFactory createDashedBorder.

Prototype

public static Border createDashedBorder(Paint paint, float thickness, float length, float spacing,
        boolean rounded) 

Source Link

Document

Creates a dashed border of the specified paint , thickness , line shape, relative length , and relative spacing .

Usage

From source file:Main.java

public Main() {
    getContentPane().setLayout(new FlowLayout());
    JLabel labelTwo = new JLabel("www.java2s.com");
    labelTwo.setBorder(BorderFactory.createDashedBorder(Color.red, 2.0f, 10.0f, 1.0f, true));

    add(labelTwo);//from   www.j  av a 2  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", TitledBorder.RIGHT, TitledBorder.BOTTOM));
    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);

}