How could i use The array texture in another class?
<p>I need to be able to use the variables in the array texture[] (wich is located int the Textures class) in the Board class. But I cant figure out how I would go about doing that.</p>

<p>This is just me trying to figure out how to add Textures to things in java, i am attempting to learn how to make games. So im very noobish haha.</p>

<p>This is the Class that i want to use the texture[] array in.</p>

<pre><code>import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

public class Board extends JPanel{

    public Board(){

    }

    public void paint(Graphics g){
        g.drawImage(texture[1], 0, 0, null);
        g.setFont(new Font("Verdana", 0, 50));
        g.setColor(Color.YELLOW);
        g.drawString(": FPS", 20, 50);
    }

    public void update(){
        repaint();
    }
}
</code></pre>

<p>This is the class that creates the texture[] array.</p>

<pre><code>import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;

public class Textures {

    BufferedImage img;
    private int w, h;
    public int id[];
    public Image texture[];

    public Textures() throws IOException {
        URL url = this.getClass().getResource("Resources/Textures.png");
        img = ImageIO.read(url);
        w = 0;
        h = 0;
        for(int i1 = 0; i1 &lt; 16; i1++){
            texture[i1] = img.getSubimage(w, h, 16, 16);
            id[i1] = i1;
            w += 16;
            h += 16;
        }
    }
}
</code></pre>
