Avoid putting components with scroll bars inside another JScrollPane, though this can be hard in a complex GUI, especially because some objects, like JTables, require to be put inside JScrollPanes (see Missing JTable Header). With automatic layout management, if you put into a JScrollPane a container that already contains a JScrollPane, you will get unexpected results in the inner pane .
If you are creating a GUI builder or script engine, add a simple method like ‘isInScrollPane’' to a general container class (like a sub-classed JPanel), and use it to decide whether to enclose it in the scroll pane or not.