I've been searching and searching for 2 days to find out why this doesn't work, I really need help.
This is my main class, I don't believe this is the problem, though:
This is the class that I'm pretty sure is where something is going wrong. My problem is, when I run it, it's not putting the image on the JPanelCode:public class Nick {
public static void main(String[] args){
TheWindow w = new TheWindow();
w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
w.setSize(700,500);
w.setVisible(true);
}
}
Code:import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
public class TheWindow extends JFrame{
private StockMarket myPanel;
Color customColor = new Color(100,149,237);
private boolean loaded;
private Image sb;
public TheWindow(){
super("ProjectN (Un-named game)");
myPanel = new StockMarket();
myPanel.setBackground(customColor);
add(myPanel, BorderLayout.CENTER);
}
public Image loadPics(){
sb = new ImageIcon(getClass().getResource("Start.png")).getImage();
return sb;
}
public void paint(Graphics g) {
if(g instanceof Graphics2D){
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
}
super.paint(g);
g.drawString("This is the current state of the game", 60, 100);
g.drawString("Things will be added soon, I'm currently working on the basic code", 60, 130);
if(sb != null) {
g.drawImage(sb, 0, 0, this);
}
}
}

