By running following code and I got following output:
At begining of default constructor, theApplet.isDisplayable()=false
Start Init here...
At begining of init(), theApplet.isDisplayable()=true
At begining of constructor, theApplet.isDisplayable()=false
End Init...
Two questions:
1. Does anybody know why isDisplayable() is changed without do anything on it?
2. Why does the JApplet not run init first, but default constructor?
import javax.swing.*;
public class TestJApplet extends JApplet{
public void init() {
System.out.println("Start Init here...");
/*this.setVisible(true);
this.validate();*/
if (this.isDisplayable()) System.out.println("At begining of init(), theApplet.isDisplayable()=true");
else System.out.println("At begining of init(), theApplet.isDisplayable()=false");
new TestJApplet("test");
System.out.println("End Init...");
}
public TestJApplet(){
if (this.isDisplayable()) System.out.println("At begining of default constructor, theApplet.isDisplayable()=true");
else System.out.println("At begining of default constructor, theApplet.isDisplayable()=false");
}
public TestJApplet(String test){
if (this.isDisplayable()) System.out.println("At begining of constructor, theApplet.isDisplayable()=true");
else System.out.println("At begining of constructor, theApplet.isDisplayable()=false");
}
}