We would like to know how to align JLabel text vertically top.
import javax.swing.JLabel; import javax.swing.JOptionPane; // www .j a v a 2 s . c o m public class Main { public static void main(String[] args) { JLabel label = new JLabel("Username :", JLabel.RIGHT); label.setVerticalAlignment(JLabel.TOP); JOptionPane.showMessageDialog(null, label); } }