Hello Guest

Display Closing

  • 1 Replies
  • 3304 Views
Display Closing
« on: June 01, 2009, 17:22:41 »
Is there any mechanizm to detect the Display closing event ?? I mean Display as an object of GLApp class. I am using a Swing window using JFrame and I start GLApp display as an answer od button clicked. I run a method GLApp.run(). But when a close GLApp Display my JFrame also closed itself. I think that GLApp display don't have any method similar to WindowListener from Swing. So if you know how to manage with this trouble, let me know. Is it possible to run GLApp as a diffrent Thread and then kill it only, leaving JFrame still working?

I've got some idea to override method run() in class GLApp and but I don't know how that function should look like. If I could do that I will be able to change the way of exiting the program from calling method exit() wchich shuts down everuthing including my JFrame. My overrided run() looks:
Code: [Select]
public void run(){
           // this == GLApp
    this.init();
    this.setup();
    this.handleEvents();
    while(!Keyboard.isKeyDown(Keyboard.KEY_E)) {
    this.handleEvents();
    this.render();
    this.update();
    }
    this.cleanup();
    }
[/b]

Beside detecting closing event I would like to make my JFrame and GLApp display work together. For example, when I change a variable in JFrame window, the changes will be shown in GLApp display. How can I do that??
« Last Edit: June 01, 2009, 19:37:05 by pawelini1 »

Re: Display Closing
« Reply #1 on: June 01, 2009, 21:37:31 »
I'm really confused by what you are saying...
What is GLApp (its not defined in LWJGL to my knowledge)? It looks like its just a class that is handling the running of stuff.
It almost sounds like you want a AWTGLCanvas inside a JFrame and then handle the JFrame closing event.
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D