Hi Everyone,
I am adding components to a Box container, and making that container the client of a JScrollPane. From their I am adding the JScrollPane to the contentPane of a JFrame. All is well in regard to adding the components and then dispalying everything. However the vertical srollBar belonging to the JScrollPane is not starting from the top of the content that I am displaying. Instead the scrollBar is starting right at the bottom of the displayed content.
Roughly the code that I have created (in a very abbreviated form) looks like this:
I have tried a number of methods in an attempt to start the content from the top, e.g.: srollRectToVisible(new Rectangle(...)), however my efforts so far have arrived at naught. The layout manager for this arrangement is the default for the box container, BoxLayout.
If anybody knows of any ways to make the scrollBars in a JScrollPane behave themselves, insights will be greatly appreciated.... I am beginning to understand the motive behind calling this a JScrollPAIN!!!
Thanks in advance for your kind assistance.
Davo
I am adding components to a Box container, and making that container the client of a JScrollPane. From their I am adding the JScrollPane to the contentPane of a JFrame. All is well in regard to adding the components and then dispalying everything. However the vertical srollBar belonging to the JScrollPane is not starting from the top of the content that I am displaying. Instead the scrollBar is starting right at the bottom of the displayed content.
Roughly the code that I have created (in a very abbreviated form) looks like this:
Code:
Box box = new Box();
JScrollPane scroll = new JScrollPane(box);
getContentPane.add(scroll);
If anybody knows of any ways to make the scrollBars in a JScrollPane behave themselves, insights will be greatly appreciated.... I am beginning to understand the motive behind calling this a JScrollPAIN!!!
Thanks in advance for your kind assistance.
Davo