I want to align my JLabel to the left.
String lText = \"mybook<
FlowLayout
uses CENTER
alignment by default. Try using LEFT
alignment for your JLabel
JPanel
container
myJPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
You might wish to set the JLabel's horizontalAlignment property. One way is via its constructor. Try:
JLabel label = new JLabel(lText, SwingConstants.LEFT);
This can also be done via the expected setter method:
label.setHorizontalAlignment(SwingConstants.LEFT);