Example usage for javax.swing JLabel setHorizontalAlignment

List of usage examples for javax.swing JLabel setHorizontalAlignment

Introduction

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

Prototype

@BeanProperty(visualUpdate = true, enumerationValues = { "SwingConstants.LEFT", "SwingConstants.CENTER",
        "SwingConstants.RIGHT", "SwingConstants.LEADING",
        "SwingConstants.TRAILING" }, description = "The alignment of the label's content along the X axis.")
public void setHorizontalAlignment(int alignment) 

Source Link

Document

Sets the alignment of the label's contents along the X axis.

Usage

From source file:AlignLabels.java

void setNalignment(JLabel b) {
    b.setHorizontalAlignment(JLabel.CENTER);
    b.setVerticalAlignment(JLabel.TOP);
}

From source file:AlignLabels.java

void setNEalignment(JLabel b) {
    b.setHorizontalAlignment(JLabel.RIGHT);
    b.setVerticalAlignment(JLabel.TOP);
}

From source file:AlignLabels.java

void setWalignment(JLabel b) {
    b.setHorizontalAlignment(JLabel.LEFT);
    b.setVerticalAlignment(JLabel.CENTER);
}

From source file:AlignLabels.java

void setCalignment(JLabel b) {
    b.setHorizontalAlignment(JLabel.CENTER);
    b.setVerticalAlignment(JLabel.CENTER);
}

From source file:AlignLabels.java

void setEalignment(JLabel b) {
    b.setHorizontalAlignment(JLabel.RIGHT);
    b.setVerticalAlignment(JLabel.CENTER);
}

From source file:AlignLabels.java

void setSWalignment(JLabel b) {
    b.setHorizontalAlignment(JLabel.LEFT);
    b.setVerticalAlignment(JLabel.BOTTOM);
}

From source file:AlignLabels.java

void setSalignment(JLabel b) {
    b.setHorizontalAlignment(JLabel.CENTER);
    b.setVerticalAlignment(JLabel.BOTTOM);
}

From source file:AlignLabels.java

void setSEalignment(JLabel b) {
    b.setHorizontalAlignment(JLabel.RIGHT);
    b.setVerticalAlignment(JLabel.BOTTOM);
}

From source file:MatteExample.java

public MatteExample() {
    super(true);//from  www.ja v  a  2  s.c  o  m
    this.setLayout(new GridLayout(1, 2, 5, 5));

    JLabel label1 = new JLabel("Matte Border");
    JLabel label2 = new JLabel("Matte Border (Icon)");

    label1.setHorizontalAlignment(JLabel.CENTER);
    label2.setHorizontalAlignment(JLabel.CENTER);

    Icon icon = new ImageIcon("yourFile.gif");
    MatteBorder matte = new MatteBorder(35, 35, 35, 35, Color.blue);
    MatteBorder matteicon = new MatteBorder(35, 35, 35, 35, icon);
    label1.setBorder(matte);
    label2.setBorder(matteicon);

    add(label1);
    add(label2);
}

From source file:TabbedPaneDemo.java

protected JComponent makeTextPanel(String text) {
    JPanel panel = new JPanel(false);
    JLabel filler = new JLabel(text);
    filler.setHorizontalAlignment(JLabel.CENTER);
    panel.setLayout(new GridLayout(1, 1));
    panel.add(filler);// w w  w  . j a  v a 2s.com
    return panel;
}