Java tutorial
import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JScrollPane; public class AddingToJScrollPane { public static void main(String args[]) { JFrame frame = new JFrame("Tabbed Pane Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JLabel label = new JLabel("Label"); label.setPreferredSize(new Dimension(1000, 1000)); JScrollPane jScrollPane = new JScrollPane(label); frame.add(jScrollPane, BorderLayout.CENTER); frame.setSize(400, 150); frame.setVisible(true); } }