I'm trying to make a simple game, but I'm having trouble with my Image not appearing.
(Im going to make a game loop, but this is just a test)
gameMain.class
public class gameMain { public static void main(String[] args){ chatBox chatBox = new chatBox(); gui gui = new gui(); gui.updateScreen(); } }
gui.class
import java.awt.*; import javax.swing.*; public class gui extends JPanel { Image img; public gui(){ JFrame f = new JFrame("BrettScape"); f.setSize(640,480); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); img = Toolkit.getDefaultToolkit().getImage("testtile.png"); } public void updateScreen(){ repaint(); } public void drawMessages(){ //TODO } public void paintComponent(Graphics g){ super.paintComponent(g); g.drawImage(img, 0, 0, null); } }