ScrollPane with image : Scrollpane « Swing JFC « Java






ScrollPane with image

ScrollPane with image
 

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;

public class ScrollPaneDemo extends JFrame {
  public ScrollPaneDemo() {
    super("JScrollPane Demo");
    ImageIcon ii = new ImageIcon("largeJava2sLogo.jpg");
    JScrollPane jsp = new JScrollPane(new JLabel(ii));
    getContentPane().add(jsp);
    setSize(300, 250);
    setVisible(true);
  }

  public static void main(String[] args) {
    new ScrollPaneDemo();
  }
}
           
         
  








Related examples in the same category

1.Creating a JScrollPane Container
2.Create a scrollable list
3.Controlling the scrollbars in a JScrollPaneControlling the scrollbars in a JScrollPane
4.JViewport: Move and View JViewport: Move and View
5.ScrollPane Sample
6.Scrollpane rulerScrollpane ruler
7.Customized ScrollPaneCustomized ScrollPane
8.Scrolling ProgrammaticallyScrolling Programmatically
9.A simple JScrollPane for a JList componentA simple JScrollPane for a JList component
10.JScrollPane with row and column headersJScrollPane with row and column headers
11.A simple JScrollPane demonstrationA simple JScrollPane demonstration
12.Watermark JScrollPane