I have written a drum machine using Java. Into said drum machine I list all 47 available MIDI drums. The instrument list is placed into a JPanel, along with a gridArray of checkboxes. The JPanel is then in turn added to a scrollpane. I have listed the MIDI drums in order of 'ground-up'. For example, the bass drum is generally at the bottom of most drum kits, so it is at the bottom of my MIDI drums list. Next up would be the snare, followed by the cymbals, and then by all the specialty percussives. Since most beats are started from the 'ground-up', laying to foundation, so to speak, I want the scroll bar of the scrollpane which houses the JPanel, which in turn houses the instrument list and the beat checkboxes, to be positioned, upon opening, at the bottom of the scroll pane. Nothing I have tried works. It always positions the slider somewhere in the middle of the scroll track. Below is a listing of just the buildGUI portion of the code, all the MIDI functionality has been removed to keep the size of the post to this forum down.
Not that you will probably need to invoke this method AFTER the frame is visible to make sure all the components have been painted on the frame and the proper size can be calculated.
@Rob Camick - Thanks for the quick response. The only 'list' in my code is the ArrayList, which is imported from java.util.*. The 'ensureIndexIsVisible(int index)' method appears to not be valid for an ArrayList. Ist there an equivalent for a JPanel? I've not found one going through the ...oracle/java/docs... route.