Hey guys,
I'm learning some Java and I got stuck on a problem.
Here's my Main.java :
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.JPanel;
public class GameFrame extends JPanel {
public GameFrame() {
setFocusable(true);
}
public void Paint(Graphics g) {
super.paint(g);
Graphics2D g2d = (Graphics2D) g;
g2d.drawString("Hello world", 150, 200);
}
}
And here's my GameFrame.java :
import javax.swing.JFrame;
public class Main {
public static void main(String[] args) {
JFrame frame = new JFrame("Game");
frame.setSize(854, 480);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOS E);
frame.add(new GameFrame());
frame.setVisible(true);
frame.setResizable(false);
}
}
It creates the JFrame but it's not drawing my text.
Thanks