Hi all, I have a complex question I cant find an answer anywhere.
here is a 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, clearly the textfields are cut. More precisely, bigPane is cut. But I would like the textfields to be resized instead of cut, so we can still use them.
Since the horizontal scrollbar is forbidden to appear, I would like the layout to forget the view's (bigPane) preferred width and always force the view's width to match the viewport's width. Like there would be no virtual viewport for the horizontal direction, only in the vertical.
I can't find a solution to that, and not even a hack, thaks if you can help.
Nico.
PS: looks like the code for ViewportLayout doesn't contain any code for that
PS2 : here is a cap of the result of the above code http://www.nraynaud.com/kilombo/testLayout.png see the right side.