I’m still getting this error sometimes
this is my code, the vm crashes when i don’t select any display mode in my selector, say, when the display is not set nor created.
public class Tutorial_1 implements Runnable{
public boolean running = true, presionando_f1;
private DisplayMode displayMode;
/**
* @param args
*/
public static void main(String[] args) {
new Tutorial_1();
System.err.println("exiting...");
}
public Tutorial_1(){
createWindow(false);
run();
}
private void createWindow(boolean fullscreen){//init the window
try{
Display.setFullscreen(fullscreen);
DisplayMode[] modes = Display.getAvailableDisplayModes();
//This shows a dialog to let you choose a display mode
int opcion = JOptionPane.showOptionDialog(null, "Select a display mode", "!",
JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE,
null, modes, 0);
if(opcion != JOptionPane.CLOSED_OPTION) {//If you have selected an option...
displayMode = modes[opcion];
Display.setDisplayMode(displayMode);
Display.setTitle("Tutorial 1 de Opengl con LWGL");
Display.create();
} else {//else, we won't loop on the run() method
//System.exit(0); // Commented to avoid vm-crash (but i still get them), i'll use this instead
running = false;
}
}catch(LWJGLException e){
e.printStackTrace();
System.exit(1);
}
}
public void run(){
while(running){
if(Display.isCloseRequested()){//Exits if requested
running = false;
}
}
}
}
thanks for the help, i’m off to a good start and i want to know where do this errors come to avoid them in further projects ;D