Check out example codes for "terminate a frame java". It will help you in understanding the concepts better.

Code Example 1

Jframe frame = new Jframe();
int count = 0;
if(count==10){
  frame.setVisable(false);
  frame.dispose();
}

Code Example 2

To terminate/close a frame in AWT, use the 'dispose()' method

"frameObject.dispose()"

Learn ReactJs, React Native from akashmittal.com