I have a Java applet and in this program I created a main panel which stores all of the child components in there. Then, I created a scroll panel to contain this main panel and manipulate it up and down. However, when the main panel opens, it has too many fields in this panel. As a result, the scroll bar in the scroll panel just keeps positioning at the bottom. Do you know any method to set this scroll bar at the beginning position (on the top) of the main panel, and how to apply this?
I did something like this:
JScrollPane scrollPane = new JScrollPane(mainPanel);
// Add the scroll pane to the center of the border
Thanks a lot.