javaswingwindowlistener

how to dispose() current JIntenalFrame in java


how to dispose() current JIntenalFrame ?

public class A extends JIntenalFrame
{
 class B extends JIntenalFrame
  {
   //i like to dispose current B class to dispose()
   B.dispose();
   }
}

i am working with some inner JIntenalFrame. is there is any way to dispose it?


Solution

  • all inner class are working on the there own path so a follows the path we can use it

     public class Main extends JIntenalFrame
    {
     public class A extends JIntenalFrame
      {
       //its an inner class
      }
     public class B extends JIntenalFrame
      {
       /*now while disposing the class B extended by the JIntenalFrame
    then use the class name and the operation()
    */
     B.this.dispose();//here the actual working code
      }
    }
    

    if you use inside the this.dispose() then it will close the Main JIntenalFrame so while working inside the JIntenalFrame for those operation we can use the CLASS_NAME.this.operation(). like wise

    B.this.dispose();