Example usage for javax.swing JLabel setBorder

List of usage examples for javax.swing JLabel setBorder

Introduction

In this page you can find the example usage for javax.swing JLabel setBorder.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.")
public void setBorder(Border border) 

Source Link

Document

Sets the border of this component.

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 a2s.co  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);

}

From source file:MainClass.java

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

    add(labelTwo);/*from   w ww . ja va2  s  .co 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);

}

From source file:Main.java

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

    add(labelTwo);//from  w w  w.  j a v  a2 s .co  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);

}

From source file:Main.java

public Main() {
    getContentPane().setLayout(new FlowLayout());
    JLabel labelTwo = new JLabel("www.java2s.com");
    labelTwo.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED, Color.red, Color.black));

    add(labelTwo);/*from  www  .j a  v a2 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);

}

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);//from   w w  w .  ja  va2s  . c  om

    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, MetalIconFactory.getFileChooserHomeFolderIcon()),
            "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);

}

From source file:CompoundBorderLineLineBorder.java

public CompoundBorderLineLineBorder() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel panel = new JPanel();
    JLabel label;

    label = new JLabel("Compound - red inside green lines");
    label.setBorder(BorderFactory.createCompoundBorder(new LineBorder(Color.green), new LineBorder(Color.red)));
    panel.add(label);//  w  ww .ja v  a  2s . c  o m
    getContentPane().add(panel);
    pack();
}

From source file:Main.java

public Main() {
    JPanel simplePanel = new JPanel(new GridLayout(7, 1, 5, 5));

    JLabel bevelRasBorderLabel = new JLabel("Raised Bevel Border", JLabel.CENTER);
    bevelRasBorderLabel.setBorder(BorderFactory.createRaisedBevelBorder());
    simplePanel.add(bevelRasBorderLabel);

    add(simplePanel);//from w  w  w .j  a  v  a2  s .  co  m
}

From source file:Main.java

public Main() {
    JPanel simplePanel = new JPanel(new GridLayout(7, 1, 5, 5));

    JLabel bevelLowBorderLabel = new JLabel("Lowered Bevel Border", JLabel.CENTER);
    bevelLowBorderLabel.setBorder(BorderFactory.createLoweredBevelBorder());
    simplePanel.add(bevelLowBorderLabel);

    add(simplePanel);/*from  w w w  .  j av a  2 s.co  m*/
}

From source file:Main.java

public Main() {
    JPanel simplePanel = new JPanel(new GridLayout(1, 1, 5, 5));

    JLabel etchedRasBorderLabel = new JLabel("Raised Etched Border", JLabel.CENTER);
    etchedRasBorderLabel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
    simplePanel.add(etchedRasBorderLabel);

    add(simplePanel);/*w ww  .j  a  va  2  s.  c  o m*/
}

From source file:Main.java

public Main() {
    JPanel simplePanel = new JPanel(new GridLayout(7, 1, 5, 5));

    JLabel etchedLowBorderLabel = new JLabel("Lowered Etched Border", JLabel.CENTER);
    etchedLowBorderLabel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
    simplePanel.add(etchedLowBorderLabel);

    add(simplePanel);/*  w ww .j  a  va  2 s  .co m*/
}