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 static void main(String[] argv) {
    BevelBorder loweredBevelBorder = (BevelBorder) BorderFactory.createLoweredBevelBorder();
    JLabel component = new JLabel("label");
    component.setBorder(loweredBevelBorder);

}

From source file:Main.java

public static void main(String[] argv) {
    EmptyBorder emptyBorder = (EmptyBorder) BorderFactory.createEmptyBorder();
    JLabel component = new JLabel("label");
    component.setBorder(emptyBorder);

}

From source file:Main.java

public static void main(String[] argv) {
    LineBorder lineBorder = (LineBorder) BorderFactory.createLineBorder(Color.black);
    JLabel component = new JLabel("label");
    component.setBorder(lineBorder);

}

From source file:Main.java

public static void main(String[] argv) {

    BevelBorder raisedBevelBorder = (BevelBorder) BorderFactory.createRaisedBevelBorder();
    JLabel component = new JLabel("label");
    component.setBorder(raisedBevelBorder);

}

From source file:Main.java

public static void main(String[] argv) {

    EtchedBorder etchedBorder = (EtchedBorder) BorderFactory.createEtchedBorder();
    JLabel component = new JLabel("label");
    component.setBorder(etchedBorder);

}

From source file:Main.java

public static void main(String[] argv) {
    ImageIcon icon = new ImageIcon("image.gif");
    MatteBorder matteBorder = (MatteBorder) BorderFactory.createMatteBorder(-1, -1, -1, -1, icon);
    JLabel component = new JLabel("label");
    component.setBorder(matteBorder);

}

From source file:Main.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Sample Borders");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Border emptyBorder = new EmptyBorder(5, 10, 5, 10);

    JLabel aLabel = new JLabel("Bevel");
    aLabel.setBorder(emptyBorder);
    aLabel.setHorizontalAlignment(JLabel.CENTER);

    frame.add(aLabel);/*  w  w  w.  ja va2  s . co  m*/
    frame.setSize(400, 200);
    frame.setVisible(true);
}

From source file:EtchedBorderSample.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Sample Borders");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Border etchedBorder = new EtchedBorder(EtchedBorder.RAISED, Color.RED, Color.PINK);

    JLabel aLabel = new JLabel("Bevel");
    aLabel.setBorder(etchedBorder);
    aLabel.setHorizontalAlignment(JLabel.CENTER);

    frame.add(aLabel);/*ww  w .j  a va2s. c o m*/
    frame.setSize(400, 200);
    frame.setVisible(true);
}

From source file:BevelBorderWithDiffBorderColor.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Sample Borders");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Border bevelBorder = new BevelBorder(BevelBorder.RAISED, Color.RED, Color.RED.darker(), Color.PINK,
            Color.PINK.brighter());

    JLabel aLabel = new JLabel("Bevel");
    aLabel.setBorder(bevelBorder);
    aLabel.setHorizontalAlignment(JLabel.CENTER);

    frame.add(aLabel);/*w  w w . ja v a  2  s  . c  om*/
    frame.setSize(400, 200);
    frame.setVisible(true);
}

From source file:MatteBorderSample.java

public static void main(String args[]) {
    JFrame frame = new JFrame("Sample Borders");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Icon diamondIcon = new ImageIcon("yourImage.gif");
    Border matteBorder = new MatteBorder(5, 10, 5, 10, diamondIcon);

    JLabel aLabel = new JLabel("Bevel");
    aLabel.setBorder(matteBorder);
    aLabel.setHorizontalAlignment(JLabel.CENTER);

    frame.add(aLabel);/* www.  j a  va2  s . c om*/
    frame.setSize(400, 200);
    frame.setVisible(true);
}