I'm posting this question because I'm new to programming at the present time and I have a pet peeve that when I create the app I don't want the objects to go across the entire window.
I use GridLayout
the most often and I was wondering if there was a way to make components such as a JTextField
or JTextArea
NOT span the entire window, leave a little space on both ends?
You can add a component to a JPanel, which uses a FlowLayout by default and all components are displayed at their preferred sizes. Then add the panel to the layout using the GridLayout. The panel will increase in size but the components on the panel will stay at their preferred size.