Ok this is one of the most frustrating things i believe… the program works perfectly when you run it off your compiler… but once you pack it into a jar file and run it through web start… hell breaks loose.
This is my problem… I have a JFrame that I am painting graphics to…
well the first part of my application runs fine, asks for name (using JOptionpane), blah blah, but once it starts to create the JFrame and container, and create the window… it crashes… all the sudden… out of nowhere… and it doesnt even tell me anything, it just… crashes to desktop… has anyone had this problem before? ill post snippets of my code, but if you need more ill gladly post more.
now my guess is, since i never seen the screen go red, but i do see the grey area, is that the application is crashing before it even gets to the game loop.
Its possible, i just thought about this, could this be an error with not being able to find the SystemTimer that is located in a timer.jar file that i have located in my jar, mabye im just not packaging everything correctly… Because im not completely sure how to package 3rd party libraries that are needed into java webstart…
weblink: http://lightsoflifesoftware.n00bl33t.com/Gratorial/src/Gratorial.v.3.0.jnlp
try{
device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
oldDisplayMode = device.getDisplayMode();
GraphicsConfiguration config = device.getDefaultConfiguration();
container = new JFrame("Gratorial 2.0 Singleplayer",config);
container.setUndecorated(true);
container.setIgnoreRepaint(true);
container.setResizable(false);
System.out.println("FS"+device.isFullScreenSupported());
System.out.println("DC"+device.isDisplayChangeSupported());
if(device.isFullScreenSupported() && device.isDisplayChangeSupported() && fullscreenChoice == 0){
device.setFullScreenWindow(container);
FULLSCREEN = true;
device.setDisplayMode(new DisplayMode(800,600,32,0));
DISPLAYMODE = true;
container.setVisible(true);}else//create windowed mode 800x600
container.createBufferStrategy(2);
strategy = container.getBufferStrategy();
container.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
container.addKeyListener(new KeyInputHandler());
requestFocus();
GAMESTART = SystemTimer.getTime(); //3rd party timer library
initEntities();//creates the pictures and assigns entities tot hem.
gameLoop();//starts game loop
}
public void gameLoop(){
long lastLoopTime = SystemTimer.getTime();
while(gameRunning){
long delta = SystemTimer.getTime() - lastLoopTime;
lastLoopTime = SystemTimer.getTime();
lastFps += delta;
fps++;
Graphics2D g = (Graphics2D)strategy.getDrawGraphics();
g.setColor(Color.RED);
g.fillRect(0,0,800,600);
g.setColor(Color.YELLOW);
// blah blah blah blah, you get the point, it just draws and stuff...
}