Here's the error I'm getting:
java.lang.StackOverflowError
at apple.awt.CGraphicsDevice.getScreenInsets(Native Method)
at apple.awt.CGraphicsDevice.getScreenInsets(CGraphicsDevice.java:673)
at apple.awt.CToolkit.getScreenInsets(CToolkit.java:741)
at java.awt.Window.init(Window.java:394)
at java.awt.Window.<init>(Window.java:432)
at java.awt.Frame.<init>(Frame.java:403)
at java.awt.Frame.<init>(Frame.java:368)
at javax.swing.JFrame.<init>(JFrame.java:158)
at D3D.<init>(D3D.java:35)
at player.<init>(player.java:1)
at D3D.<init>(D3D.java:17)
at player.<init>(player.java:1)
And here's the player class:
public class player extends D3D
{
int playerX, playerY;
boolean east, west, south, north;
public void setPlayer()
{
playerX = 1; playerY = 1;
east=true; west=false; north=false; south=false;
}
}
And here's the D3D class:
public class D3D extends JFrame
{
player player = new player();
mapgeneration levelmap = new mapgeneration();
boolean ONE, TWO, THREE, FOUR, FIVE;
boolean ONEhighlight,TWOhighlight,THREEhighlight,FOURhighlight,FIVEhighlight;
Timer timer = new Timer(250,new ActionListener() {
public void actionPerformed(ActionEvent evt) {
repaint();
}
});
String tracer;
Image Example = Toolkit.getDefaultToolkit().getImage("images/example.png");
Image Startup = Toolkit.getDefaultToolkit().getImage("images/Startup.png");
Image ButtonHighlight = Toolkit.getDefaultToolkit().getImage("images/ButtonHighlight.png");
public D3D()
{
super();
setSize(342,277);
...
JPanel main = new JPanel()
{
public void paintComponent(final Graphics g)
{
super.paintComponent(g);
timer.start();
g.drawImage(Startup,0,0,this);
...
};
};
add(main);
}
public void init()
{
player.setPlayer();
levelmap.populateGraph();
}
public static void main(String[] args)
{
D3D game = new D3D();
game.setTitle("Dungens:3D");
game.init();
game.setVisible(true);
}
}
I've been looking at this for hours and have narrowed it down to what you see here. To be honest, it's probably some stupid little petty thing that I'm glancing over.
Thanks guys.
at D3D.<init>(D3D.java:35) at player.<init>(player.java:1Does that mean the error is occurring at line 35 of D3d and line 1 of player?