Swing: easiest way to align width of [dynamic][static][dynamic] components?
- by java.is.for.desktop
What is the easiest way in standard Java Swing to align three components in such a way that:
the dynamic widths of Component1 and Component3 are adjusted to be equal,
while Component2 (which is in between) has constant width?
Imagine we have some resizable JPanel (such as inside a JFrame).
Small width should look like this:
[----------------whole JPanel----------------]
[--Component1--] [Component2] [--Component3--]
Big width should look like this:
[------------------------whole JPanel------------------------]
[------Component1------] [Component2] [------Component3------]
Note: I just "trialed-and-errored" with GroupLayout for too long.