Hi, in my game I added a new "board" whcih starts the game. However once I finish the game, I have a boolean varaible and I set it to true. How can I use that variable to dispose of the Jframe I was using?
I am doing something like this, however it is not working. Is there a better way than doing this? Like terminating the Thread it self?
final static Runnable game_main = new Runnable() {
public void run() {
JFrame baseLevel = new JFrame("Half Life 3 - Episode 1");
ImageIcon img = new ImageIcon("Pictures/Half-Life.png");
// Base Level
baseLevel.add(new Board());
baseLevel.setSize((HEIGHT - 3) * SCALE, WIDTH * SCALE);
baseLevel.setIconImage(img.getImage());
baseLevel.setLocationRelativeTo(null);
baseLevel.setVisible(true);
baseLevel.setResizable(false);
if(Board.game_end == true){
try {
Thread.sleep(1500);
} catch (Exception e) {
e.getMessage();
}
baseLevel.dispose();
}
}
};