Example usage for javax.swing JLabel setVerticalAlignment

List of usage examples for javax.swing JLabel setVerticalAlignment

Introduction

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

Prototype

@BeanProperty(visualUpdate = true, enumerationValues = { "SwingConstants.TOP", "SwingConstants.CENTER",
        "SwingConstants.BOTTOM" }, description = "The alignment of the label's contents along the Y axis.")
public void setVerticalAlignment(int alignment) 

Source Link

Document

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

Usage

From source file:Main.java

public Main() throws HeadlessException {
    setSize(150, 300);//from w  w w.  java 2  s.  c  om
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setLayout(new FlowLayout());

    JLabel label1 = new JLabel("Username :", JLabel.RIGHT);
    JLabel label2 = new JLabel("Password :", JLabel.RIGHT);
    JLabel label3 = new JLabel("Confirm Password :", JLabel.RIGHT);
    JLabel label4 = new JLabel("Remember Me!", JLabel.LEFT);
    JLabel label5 = new JLabel("Hello.", JLabel.CENTER);

    label5.setVerticalAlignment(JLabel.TOP);
    label5.setToolTipText("A tool tip with me!");

    getContentPane().add(label1);
    getContentPane().add(label2);
    getContentPane().add(label3);
    getContentPane().add(label4);
    getContentPane().add(label5);
}

From source file:AlignLabels.java

void setNWalignment(JLabel b) {
    b.setHorizontalAlignment(JLabel.LEFT);
    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 setSWalignment(JLabel b) {
    b.setHorizontalAlignment(JLabel.LEFT);
    b.setVerticalAlignment(JLabel.BOTTOM);
}

From source file:AlignLabels.java

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

From source file:AlignLabels.java

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

From source file:AlignLabels.java

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

From source file:AlignLabels.java

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

From source file:AlignLabels.java

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

From source file:AlignLabels.java

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