import java.awt.*; import javax.swing.*; class ScrolledPane extends JFrame { private JScrollPane scrollPane; public ScrolledPane() { setTitle( "Scrolling Pane Application" ); setSize( 200, 200 ); setBackground( Color.gray ); setDefaultCloseOperation(EXIT_ON_CLOSE); JPanel topPanel = new JPanel(); topPanel.setLayout( new BorderLayout() ); getContentPane().add( topPanel ); //Icon image = new ImageIcon( "chanceBlue.gif" ); JLabel label = new JLabel( "Hello World" ); // Create a tabbed pane scrollPane = new JScrollPane(); scrollPane.getViewport().add( label ); topPanel.add( scrollPane, BorderLayout.CENTER ); } public static void main( String args[] ) { // Create an instance of the test application ScrolledPane mainFrame = new ScrolledPane(); mainFrame.setVisible( true ); } }