K im still having a huge issue with this.
Here is my class that is grabing my image:
package battleApplet;
import javax.swing.*;
import java.awt.*;
import java.awt.image.*;
/**
* @author zalexander TODO This Draws the background
*/
public class GuiInterface extends JViewport {
private String dir = System.getProperty("user.dir");
private String imageFile1 = dir + "/images/monkey_bigwrench.gif";
private TexturePaint imagePaint1;
private Rectangle imageRect;
public GuiInterface() {
BufferedImage image = ImageUtilities.getBufferedImage(imageFile1, this);
imageRect = new Rectangle(0, 0, image.getWidth(), image.getHeight());
imagePaint1 = new TexturePaint(image, imageRect);
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2d = (Graphics2D)g;
g2d.setPaint(imagePaint1);
g2d.fill(imageRect);
g2d.setPaint(Color.black);
g2d.draw(imageRect);
}
}
and in my main class:
I import the class
import battleApplet.GuiInterface;
then i create the new object
private GuiInterface guiInterface = new GuiInterface()
then in my init() method where IM building my interface I want to put it here
guiInterface.paintComponent(Graphics g);
But it is telling me it can’t find the g in (Graphics g).
What am I doing wrong?