how to dispose() current JIntenalFrame in java

573 views Asked by At

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?

2

There are 2 answers

0
Akib Bagwan On BEST ANSWER

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();

1
Shaine On

You can use JDesktopPane.getSelectedFrame().dispose();