Example usage for javax.swing JLabel JLabel

List of usage examples for javax.swing JLabel JLabel

Introduction

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

Prototype

public JLabel(Icon image, int horizontalAlignment) 

Source Link

Document

Creates a JLabel instance with the specified image and horizontal alignment.

Usage

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JLabel label = new JLabel("Text Label", JLabel.RIGHT);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JLabel label = new JLabel("Text Label", JLabel.LEFT);
    label.setVerticalAlignment(JLabel.TOP);

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    JLabel label = new JLabel("Text Label", JLabel.LEFT);
    label.setVerticalAlignment(JLabel.BOTTOM);

}

From source file:Main.java

public static void main(String[] args) {
    JLabel label = new JLabel("Username :", JLabel.RIGHT);
    label.setVerticalAlignment(JLabel.TOP);

    JOptionPane.showMessageDialog(null, label);

}

From source file:Main.java

public static void main(String[] args) {

    JLabel label = new JLabel("<html>Line<br>line<br>line</html>", JLabel.LEFT);

    JOptionPane.showMessageDialog(null, label);

}

From source file:Main.java

public static void main(String[] args) {
    JLabel label = new JLabel("Username :", JLabel.RIGHT);

    label.setToolTipText("A tool tip with me!");

    JOptionPane.showMessageDialog(null, label);

}

From source file:Main.java

public static void main(String[] args) {

    JLabel label = new JLabel("java2s.com", JLabel.LEFT);
    label.setText("Centered");

    JOptionPane.showMessageDialog(null, label);

}

From source file:Main.java

public static void main(String[] args) {
    JLabel label = 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);

    JOptionPane.showMessageDialog(null, label);

}

From source file:Main.java

public static void main(String[] args) {

    JLabel label = new JLabel("java2s.com", JLabel.LEFT);
    label.setHorizontalAlignment(JLabel.CENTER);
    label.setVerticalAlignment(JLabel.CENTER);

    //label.setHorizontalAlignment(JLabel.LEFT);
    //label.setVerticalAlignment(JLabel.TOP);

    //label.setHorizontalAlignment(JLabel.RIGHT);
    //label.setVerticalAlignment(JLabel.BOTTOM);

    JOptionPane.showMessageDialog(null, label);

}

From source file:Main.java

public static void main(String[] args) {

    JLabel label = new JLabel("Full Name :", JLabel.LEFT);

    label.setFont(new Font("Georgia", Font.PLAIN, 14));

    JOptionPane.showMessageDialog(null, label);

}