Problemas JScrollPane!

Boa noite galera GUJ,

estou contruindo uma GUI pelo Jigloo(plugin do eclipse), segue o codigo abaixo…
porem quando uma figura mto grande eh inserida no painel nao aparece os scrollsbars, pq?? ajudem-me por favorrrr
Obrigado

package GUI;
import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.border.LineBorder;
import javax.swing.SwingUtilities;

/**

  • This code was edited or generated using CloudGarden’s Jigloo

  • SWT/Swing GUI Builder, which is free for non-commercial

  • use. If Jigloo is being used commercially (ie, by a corporation,

  • company or business for any purpose whatever) then you

  • should purchase a license for each developer using Jigloo.

  • Please visit www.cloudgarden.com for details.

  • Use of Jigloo implies acceptance of these licensing terms.

  • A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR

  • THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED

  • LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
    */
    public class NewJFrame extends javax.swing.JFrame {
    private JPanel jPanel1;
    private JTextField jTextField2;
    private JTextField jTextField1;
    private JPanel jPanel3;
    private JPanel jPanel2;
    private JMenuItem jMenuItem3;
    private JMenuItem jMenuItem2;
    private JMenuItem jMenuItem1;
    private JPanel jPanel7;
    private JScrollPane jScrollPane1;
    private JPanel jPanel6;
    private JButton jButton2;
    private JButton jButton5;
    private JButton jButton4;
    private JButton jButton3;
    private JPanel jPanel5;
    private JPanel jPanel4;
    private JButton jButton1;
    private JMenu jMenu1;
    private JMenuBar jMenuBar1;

    private Image img;

    /**

    • Auto-generated main method to display this JFrame
      */
      public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable() {
      public void run() {
      NewJFrame inst = new NewJFrame();
      inst.setLocationRelativeTo(null);
      inst.setVisible(true);
      }
      });
      }

    public NewJFrame() {
    super();
    initGUI();
    }

    private void initGUI() {
    try {
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    this.setTitle(“Ipicture”);

      	{
      		jMenuBar1 = new JMenuBar();
      		setJMenuBar(jMenuBar1);
      		{
      			jMenu1 = new JMenu();
      			jMenuBar1.add(jMenu1);
      			jMenu1.setText("Arquivo");
      			{
      				jMenuItem1 = new JMenuItem();
      				jMenu1.add(jMenuItem1);
      				jMenuItem1.setText("Abrir");
      				jMenuItem1.setBorder(BorderFactory.createTitledBorder(""));
      				jMenuItem1.addActionListener(new ActionListener() {
      					public void actionPerformed(ActionEvent evt) {
      						jMenuItem1ActionPerformed(evt);
      					}
      				});
      			}
      			{
      				jMenuItem2 = new JMenuItem();
      				jMenu1.add(jMenuItem2);
      				jMenuItem2.setText("Salvar");
      				jMenuItem2.addActionListener(new ActionListener() {
      					public void actionPerformed(ActionEvent evt) {
      						jMenuItem2ActionPerformed(evt);
      					}
      				});
      			}
      			{
      				jMenuItem3 = new JMenuItem();
      				jMenu1.add(jMenuItem3);
      				jMenuItem3.setText("Sair");
      				jMenuItem3.addActionListener(new ActionListener() {
      					public void actionPerformed(ActionEvent evt) {
      						jMenuItem3ActionPerformed(evt);
      					}
      				});
      			}
      		}
      	}
      	{
      		jPanel2 = new JPanel();
      		BorderLayout jPanel2Layout = new BorderLayout();
      		getContentPane().add(jPanel2, BorderLayout.CENTER);
      		jPanel2.setLayout(jPanel2Layout);
      		{
      			jPanel3 = new JPanel();
      			jPanel3.setLayout(null);
      			jPanel2.add(jPanel3, BorderLayout.EAST);
      			jPanel3.setPreferredSize(new java.awt.Dimension(98, 229));
      			{
      				jTextField1 = new JTextField();
      				jPanel3.add(jTextField1);
      				jTextField1.setText("Nome");
      				jTextField1.setBounds(12, 12, 59, 22);
      			}
      			{
      				jTextField2 = new JTextField();
      				jPanel3.add(jTextField2);
      				jTextField2.setText("CNPJ");
      				jTextField2.setBounds(12, 46, 59, 22);
      			}
      			{
      				jButton1 = new JButton();
      				jPanel3.add(jButton1);
      				jButton1.setText("Salvar");
      				jButton1.setBounds(12, 89, 68, 30);
      				jButton1.addActionListener(new ActionListener() {
      					public void actionPerformed(ActionEvent evt) {
      						jButton1ActionPerformed(evt);
      					}
      				});
      			}
      		}
      		{
      			jPanel6 = new JPanel();
      			BorderLayout jPanel6Layout = new BorderLayout();
      			jPanel6.setLayout(jPanel6Layout);
      			jPanel2.add(jPanel6, BorderLayout.CENTER);
      			{
      				jScrollPane1 = new JScrollPane();
      				jPanel6.add(jScrollPane1, BorderLayout.CENTER);
      				jScrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
      				jScrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
      				{
      					jPanel7 = new JPanel() {
      						
      						public void paintComponent(Graphics g) {   
      							
      							super.paintComponent(g);
      							
      							//g.drawImage(img,0,0,this.getHeight(),this.getWidth(),this);
      							g.drawImage(img,0,0,null);
      							
      							this.repaint();
      							//this.validate();
      						}
      					};
      					jScrollPane1.setViewportView(jPanel7);
      				}
      			}
      		}
      	}
      	{
      		jPanel1 = new JPanel();
      		BorderLayout jPanel1Layout = new BorderLayout();
      		getContentPane().add(jPanel1, BorderLayout.SOUTH);
      		jPanel1.setLayout(jPanel1Layout);
      		jPanel1.setPreferredSize(new java.awt.Dimension(400, 24));
      		{
      			jPanel5 = new JPanel();
      			GridLayout jPanel5Layout = new GridLayout(1, 1);
      			jPanel5Layout.setColumns(1);
      			jPanel5Layout.setHgap(5);
      			jPanel5Layout.setVgap(5);
      			jPanel1.add(jPanel5, BorderLayout.CENTER);
      			jPanel5.setLayout(jPanel5Layout);
      			{
      				jButton2 = new JButton();
      				jPanel5.add(jButton2);
      				jButton2.setText("<<");
      				jButton2.addActionListener(new ActionListener() {
      					public void actionPerformed(ActionEvent evt) {
      						jButton2ActionPerformed(evt);
      					}
      				});
      			}
      			{
      				jButton3 = new JButton();
      				jPanel5.add(jButton3);
      				jButton3.setText("<");
      				jButton3.addActionListener(new ActionListener() {
      					public void actionPerformed(ActionEvent evt) {
      						jButton3ActionPerformed(evt);
      					}
      				});
      			}
      			{
      				jButton4 = new JButton();
      				jPanel5.add(jButton4);
      				jButton4.setText(">");
      				jButton4.addActionListener(new ActionListener() {
      					public void actionPerformed(ActionEvent evt) {
      						jButton4ActionPerformed(evt);
      					}
      				});
      			}
      			{
      				jButton5 = new JButton();
      				jPanel5.add(jButton5);
      				jButton5.setText(">>");
      				jButton5.setPreferredSize(new java.awt.Dimension(73, 24));
      				jButton5.addActionListener(new ActionListener() {
      					public void actionPerformed(ActionEvent evt) {
      						jButton5ActionPerformed(evt);
      					}
      				});
      			}
      		}
      		{
      			jPanel4 = new JPanel();
      			jPanel1.add(jPanel4, BorderLayout.EAST);
      			jPanel4.setPreferredSize(new java.awt.Dimension(100, 24));
      		}
      	}
      	pack();
      	setSize(400, 300);
      } catch (Exception e) {
      	e.printStackTrace();
      }
    

    }

    private void jMenuItem1ActionPerformed(ActionEvent evt) {

       JFileChooser fc = new JFileChooser();
       fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
       
       int validador = fc.showOpenDialog(NewJFrame.this);
       
       if(validador == JFileChooser.APPROVE_OPTION) {
      	 
      	 File file = fc.getSelectedFile();
      	 String caminho = (String) file.getAbsolutePath();
      	 
      	 img = Toolkit.getDefaultToolkit().createImage(caminho);
      	 
      	 
       }
      	 
      //System.out.println("jMenuItem1.actionPerformed, event="+evt);
      //TODO add your code for jMenuItem1.actionPerformed
    

    }

http://www.java2s.com/Code/Java/Swing-JFC/ScrollPanewithimage.htm

adicione ao seu JScrollpane um jPanel…qd pegar a imagem, pegue o tamanho dela e aplique no jPanel

assim:

 jPanel.setPreferredSize(comprimentoImagem,alturaImagem);