Posted By:
Dmitry_Zakharov
Posted On:
Wednesday, October 17, 2001 01:41 AM
I have written the following code: JTextPanel panel = new JTextPanel(); panel.setBoxLayout(new BoxLayout(panel,BoxLayout.Y_AXIS)); // adding many JTextPane s with text JScrollPane scroll = new JScrollPane(panel); scroll.getVerticalScrollBar().setValue( some big value for scrolling to middle of panel ); Now preferred size ( getPreferredSize() method) for the first (the upper) component in panel isn't correct. It seems that preferred size for non-visible components in ScrollPane is not evaluated. If I scroll up than scrolling is not smooth. While I'm scrolling up and upper component hasn't yet appeared, scrolling is smooth. When upper component is appearing I don't
More>>
I have written the following code:
JTextPanel panel = new JTextPanel();
panel.setBoxLayout(new BoxLayout(panel,BoxLayout.Y_AXIS));
// adding many JTextPane
s
with text
JScrollPane scroll = new JScrollPane(panel);
scroll.getVerticalScrollBar().setValue(
some big value for scrolling to middle of panel
);
Now preferred size (
getPreferredSize()
method) for the first (the upper) component in panel isn't correct. It seems that preferred size for non-visible components in ScrollPane is not evaluated. If I scroll up than scrolling is not smooth. While I'm scrolling up and upper component hasn't yet appeared, scrolling is smooth. When upper component is appearing I don't see underbody of component I see the component entirely. It seems that preferred size of the component is calculated only when the component should be appeared on the JScrollPane.
Can anybody explain this behaviour ?
How can I force calculating preferred size of
all
components of panel ?
<<Less