setDefaultButton on JPanel in Applet

105 Views Asked by At
public class test_Applet extends Applet {
    public void init(){
        JPanel test = new testPanel();
        test.setVisible(true); 
        this.add(test);
        System.out.println(test.getRootPane());
        //returns null
    }

}

I need a way to change the DefaultButton on my JPanel, so that when someone pressed enter a button in the JPanel is pressed. However, I can't do that since getRootPane() returns null.

0

There are 0 best solutions below