I have a difficult question that I cannot find anywhere.
here is an example:
public static void main(final String[] args) {
final JFrame frame = new JFrame("test");
final JPanel bigPane = new JPanel(new GridLayout(0, 1));
frame.setContentPane(new JScrollPane(bigPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
bigPane.add(new JTextField("reterterter ertertrert erterter ert"));
bigPane.add(new JTextField(" ertertrert erterter ert"));
bigPane.add(new JTextField("reterterter ertertrert ert"));
bigPane.add(new JTextField("reterterter ertertrert erterter "));
frame.pack();
frame.setSize(frame.getSize().width/2, frame.getSize().height);
frame.setVisible(true);
}
Here it is clear that the text fields are cut. More precisely, bigPane is cut. But I would like the text fields to be changed, not cut, so we can still use them.
Since horizontal scrollbar is not allowed, I would like the layout to forget the preferred width of the view (bigPane) and always increase the width of the view to the width of the viewport. Like the virtual viewport for horizontal direction, only in the vertical area.
I can’t find a solution to this or even hack if you can help.
Niko.
PS: it looks like the code for ViewportLayout does not contain any code for this
PS2: http://www.nraynaud.com/kilombo/testLayout.png, .