how to put text to the right and center of jlabel code example
Example 1: center justify jlabel
import javax.swing.SwingConstants;
import javax.swing.JLabel;
Jlabel label1 = new Jlabel("Test");
label1.setHorizontalAlignment(SwingConstants.CENTER);
//Can also use SwingConstants.LEFT & .RIGHT
Example 2: horizontalAlignment center jlabel
JLabel lab=new JLabel("text");
lab.setHorizontalAlignment(SwingConstants.LEFT);