HI Guys ,
Merry Christmas and Happy New Year to all of you .
Just had a few questions regarding getting the scrollbars in JScrollPane 1> What is the difference between setSize() and setPreferredSize()
2> If I need to get the scrollbars in JScrollPane do I need to set the size or preferred size of the component it contains to bigger than the JScrollPAne or the parent component of the JScrollPane ? Let me explain with an example :-
Remember an action means a button being pressed or similar; this is a "high-level" event, which you are doubtless familiar with from using web browsers, word processors, etc. Moving a mouse is a "low-level" event which you may wish to ignore. As a simple rule of thumb, it is usually better to use the highest-level event available to fulfil your requirements.
Joined: Jun 13, 2009
Scrollbars appear automatically when the "preferred size" of the component added to the viewport of the scrollpane is greater than the size of the scrollpane. So somewhere you need to determine the preferred size of your desktop pane and then use: