Disable a frame before dispose

    paused = false;
    running = !running;
    Graphics g = start.getGraphics();
    Component glassPane = start.getGlassPane();
    Main.running = true;

This is my code for disabling my jframe, loading a new one, and disposing it. Whenever I do this, when I return to the frame I get strange graphical errors.

How do I close the frame completly?


  • create private/public(depends of your code design) variable for JFrame instance

  • then you can't bothering with dispose of visible JFrame and then re_create a new one

  • create class or local instace that returns JPanel with game content

  • call JFrame#getContentPane#removeAll()

  • call JFrame#getContentPane#add(new GamePanel())

  • maybe there are easiest ways how to reset whatever (depends of your code design) to the start_up statuses

Need Your Help

Trouble Installing Git on CentOS

linux git centos yum

I'm having trouble installing Git on CentOS 5.5 x86_64. I'm not an expert at this type of thing, what's the problem?

CG/GLSL how to calculate camera-distance per pixel?

glsl shader distance hlsl cg

I would like to output in my pixelshader the actual camera distance per pixel. This means, the result should (aside from some slight variations in precision and clamping) not depend upon the near/far