Can any one tell my why the images is not affective?

/*
 * TPanel.java
 *
 * Created on December 9, 2007, 7:42 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package keycards;

/*
 * TPanel.java
 *
 * Created on July 17, 2006, 8:23 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.BorderFactory.*;
//import keycards.KeyFrame4.*;

//import keycards.Control;
import javax.swing.*;
import java.io.*;
import java.io.BufferedReader;
import javax.swing.JTextArea.*;
import javax.swing.JList;
import javax.swing.JSeparator;
import javax.swing.JMenuItem;

public class TPanel extends JPanel
{
    public JPanel coverpanel;
   // public KeyFrame4 keyFrame4Obj;
    public JMenuBar jmenubar;
    public JMenu jmenufile;
    public JMenu jmenuedit;
    public JMenu jmenuhelp;
    public JMenuItem jmenuitemopen;
    public JMenuItem jmenuitemread;
    public JMenuItem jmenuitemwrite;
    public JMenuItem jmenuitemsave;
    public JMenuItem jmenuitemsaveas;
    public JMenuItem jmenuitemabout;
    public JSeparator jseparator_1;
    public Image image;
    //public Control controlObj = new Control();
    
    //must have equal elements in each array(tabpanels[] and content[] 
    public String tabpanels[] = {"Key Cards"};
    public JPanel content[] = {};
    //must have equal elements in each array(tabs[] and images[] 
    public String tabs[] = {"Arpeggios","Pentatonic","Modes","Minor Scales","Major"};
    public String [] images = {"modes.gif","modes.gif","Solar Eclipse.jpg","Paradise.jpg","Ocean Wave.jpg"};
    public JFrame f;
    public JScrollPane scrollPane;
    public JTabbedPane keytabbedpane = new JTabbedPane();
    public Image[] imagehold;
    public int s = 0;
    public int i = 0;
    public int z =0;
    public int go =0;
    public JPanel j;
    public TPanel(){
        
       
		//tabbedPanelPanels();//add tabs and objects  to a JTabbedPane via createpane()
		tabbedPanelImage();//adds tabs and image's to JScrollPanes then to a JTabbedPane via scrollPanel();'
                
                add(createMenu(),"North");
   }

    public void tabbedPanelImage(){
    i = 0;
    z =0;
    go =0;
    setLayout (new BorderLayout());
        while (go < tabs.length){
                keytabbedpane.addTab(tabs[z], null , scrollPanel());
                keytabbedpane.setSelectedIndex(0);
                add (keytabbedpane, BorderLayout.CENTER);
               
        }
    }
    JScrollPane scrollPanel(){
        setLayout(new BorderLayout());
        Icon icon = new ImageIcon(getClass().getResource(images[i]));
        JLabel pic = new JLabel(icon);
        JScrollPane scrollPane = new JScrollPane(pic);
        i++;
        z++;
        go++;
        return scrollPane;
    }
    ////////////////////////////addPanels(refpanel,tabname)
    /*
    public void tabbedPanelPanels(){
        s=0;
        z=0;
        go=0;
        setLayout (new BorderLayout());
        while (go < tabpanels.length){
            keytabbedpane.addTab(tabpanels[z], null ,extraPanels(content[s]));
            keytabbedpane.setSelectedIndex(0);
            add (keytabbedpane, BorderLayout.CENTER);
            s++;
            go++;
            z++;
        }
    }
    public JPanel extraPanels(JPanel t){
        JPanel x = new JPanel();
        x=t;
        return x;
    }
   */
   
    
    public JMenuBar createMenu(){
        JMenu jmenufile = new JMenu("File");
        JMenu jmenuedit = new JMenu("Edit");
        JMenu jmenuhelp = new JMenu("Help");
        JMenuBar menuBar = new JMenuBar();
        menuBar.add(jmenufile);
        menuBar.add(jmenuedit);
        menuBar.add(jmenuhelp);
       
        return menuBar;
    }
    public static void main (String args[]){
        JFrame f = new JFrame ("Music Lessons");
        TPanel tPanelObj = new TPanel();
        f.getContentPane().add(tPanelObj);
       // JPanel j = new TPanel();
        f.setVisible(true);
        
       // f.getContentPane().add(j);
        //f.pack();
        f.setSize (670,430);
        
        
        f.setSize(900,700);
        f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        f.show();
    }
}

Because you have not initialised i in that method. You do in the method before it, but i is outside that scope when you actually use. Also, the same can be said for the variable z.

This article has been dead for over six months. Start a new discussion instead.