Question

I have a program with a bunch of fields in a single panel, both labels and text fields. I needed to separate them somehow with a line to make it easier to read.

I have the panel built with SpringLayout. I was wondering if there is an easy way to create a horizontal line in SpringLayout without dividing the panel into 2, and adding a divider panel in between them.

Thanks!

Was it helpful?

Solution

I think the best practice would be creating another JPanel, but if I correctly understood your problem, maybe an alternative can be create a JSeparator:

JSeparator separator = new JSeparator(SwingConstants.HORIZONTAL);
separator.setPreferredSize(new Dimension(200,3));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top