import java.awt.Container;
import java.io.File;
import javax.swing.JFrame;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
public class JScroll
{
public static void main(String[] args){
JFrame frame=new JFrame("we");
Container cont=frame.getContentPane();
String picpath="f:"+File.separator+"b.jpg";
Icon icon=new ImageIcon(picpath);
JPanel pan=new JPanel();
JLabel lab=new JLabel(icon);
pan.add(lab);
JScrollPane scr=null;
scr=new JScrollPane(pan,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
cont.add(scr);
frame.setSize(230,120);
frame.setLocation(300,200);
frame.setVisible(true);
}
}
import java.io.File;
import javax.swing.JFrame;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
public class JScroll
{
public static void main(String[] args){
JFrame frame=new JFrame("we");
Container cont=frame.getContentPane();
String picpath="f:"+File.separator+"b.jpg";
Icon icon=new ImageIcon(picpath);
JPanel pan=new JPanel();
JLabel lab=new JLabel(icon);
pan.add(lab);
JScrollPane scr=null;
scr=new JScrollPane(pan,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
cont.add(scr);
frame.setSize(230,120);
frame.setLocation(300,200);
frame.setVisible(true);
}
}