Is there an easier way to just remove the horizontal space in front of the first component in FlowLayout?
This is basically what my code looked like :
JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
JLabel label1 = new JLabel("Hello");
JLabel label2 = new JLabel("Goodbye");
panel.add(label1);
panel.add(label2);
What I'm seeing is that there is a horizontal gap between label1 and label2, however, it also added spacing in front of label1. My current solution is remove the horizontal gap and add an EmptyBorder to label2 to fix this.
But for situations with many components, I am wondering if there is a more easy and efficient way to do something this simple?