jGuru Forums

<tt>JTextPane</tt> have incorrect preferred size after I add it in the viewport of <tt>JScrollPane</tt>
0 posts in topic
Flat View
TOPIC ACTIONS:

Posted By:   Dmitry_Zakharov
Posted On:   Friday, January 18, 2002 02:17 AM

Viewport of JScrollPane is JPanel with BoxLayout layout manager. I add to this JPanel several JTextPane 's with long text and several JLabel 's (after each JTextPane one JLabel ). The first several JTextPane 's, which I see on the viewport, have correct preferred size. The last JTextPane has incorrect its preferred size (the height is magic number 6). When I'm scrolling down the slider of vertical scroll bar decrease its size. If I don't add any JLabel (add only JTextPane ), then the preferred size of all JTextPane s is correct. Can anybody explain me why in the first case the the lasts JTextPane s have incorrect s   More>>

Viewport of JScrollPane is JPanel with BoxLayout layout manager. I add to this JPanel several JTextPane 's with long text and several JLabel 's (after each JTextPane one JLabel ).

The first several JTextPane 's, which I see on the viewport, have correct preferred size. The last JTextPane has incorrect its preferred size (the height is magic number 6). When I'm scrolling down the slider of vertical scroll bar decrease its size.

If I don't add any JLabel (add only JTextPane ), then the preferred size of all JTextPane s is correct.

Can anybody explain me why in the first case the the lasts JTextPane s have incorrect size and the second case all JTextPane 's have correct size.

May be I encounter with bug in JDK ? I use JDK 1.3.1.