如何在 java 中处理()当前 JInternalFrame

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

我正在和一些内在的人一起工作 JIntenalFrame。 有什么办法可以处理吗?

您可以使用 JDesktopPane.getSelectedFrame().dispose();

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
  }
}

如果您在 this.dispose() 内部使用,那么它将关闭 Main JIntenalFrame,因此在 JIntenalFrame 内部工作时我们可以使用 CLASS_NAME.this.operation()。 很聪明

B.this.dispose();