+ 1
What is the difference between static inner class and inner class?
7 Answers
+ 3
A class Nested or declared inside a class as static is called as static inner class. A non-static nested class is called as inner class just.
Further differences are how and what they allowed to access...... See in this..
https://docs.oracle.com/javase/tutorial/java/javaOO/nested.html
+ 1
You may find answer in https://www.java67.com/2012/10/nested-class-java-static-vs-non-static-inner.html
+ 1
Inner classes also k own as Non- Stack classes have access to other members of the top class, even if they are declared private while Static nested classes, do not have access to ther members of the top class.Inner 1 is our static inner class and inner 2 is our inner class which is not static.
0
Adham Empire
Added Question is not clear to me..
JFrame is the top level window that contains all other components like, button, lebel, text box,... etc.
And this frame is added to the panel at top level so, Jpanel for JFrame is top level refference..
0
Jayakrishna🇮🇳
I need name of method
0
JFrame tFrame = (JFrame) SwingUtilities.getWindowAncestor(this);
Also Depending on how you implemented, then some methods that returns JFrame refference are..
getRoot(); //if frame is top level window
JComponent.getTopLevelAncesto();
Refferences:
https://stackoverflow.com/questions/9650874/java-swing-obtain-window-jframe-from-inside-a-jpanel
https://stackoverflow.com/questions/9195422/how-to-reference-top-level-container-throughout-application-without-making-it-a