|
squeeze JPanel horizontally to fit JScrollPane
Hello, I am a beginner using Java and I have some questions in regard to JScrollPane.
I have a JPanel which contains many JTextField's in a single row.
I have placed the JPanel inside a JScrollPane.
I have disabled horizontal scrolling and set vertical scrolling "as needed."
How can I force the JPanel to resize its width to never exceed the width of the JScrollpane to eliminate the need for horizontal scrolling ?
I only want it to exceed vertically if needed so the user may scroll down.
I have tried the JPanel.setSize(); method but it has no effect.
Any help will be greatly appreciated, thank you
|