import java.awt.Dimension;
import java.awt.Rectangle;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.Scrollable;
public class Main extends JLabel implements Scrollable {
public Main(ImageIcon i) {
super(i);
}
public Dimension getPreferredScrollableViewportSize() {
return getPreferredSize();
}
public int getScrollableBlockIncrement(Rectangle r, int orietation,
int direction) {
return 10;
}
public boolean getScrollableTracksViewportHeight() {
return false;
}
public boolean getScrollableTracksViewportWidth() {
return false;
}
public int getScrollableUnitIncrement(Rectangle r, int orientation,
int direction) {
return 10;
}
public static void main(String[] args) {
JFrame f = new JFrame("JScrollPane Demo");
ImageIcon ii = new ImageIcon("largerntsoftLogo.gif");
JScrollPane jsp = new JScrollPane(new Main(ii));
f.getContentPane().add(jsp);
f.setSize(300, 250);
f.setVisible(true);
}
}