Hello,
I'm creating a program that will be dealing with multiple objects that extend Applet and a JFrame that will be displaying them. I created a test that swiched off between two applets I made. While I was creating the test, I noticed some things and have few questions regarding Applet and JFrame.
My first test involved one new applet and one I created that was used by an html file. From that test I realized the web applet failed to run (null pointer exceptoin). Why would an applet that normally works on web, fail to run in a JFrame? Particularly fails when init() is called.
After working around the issue of the first test by creating a different applet, there was another thing I noticed, the applet was covered by the frame of the window. How do I correct this issue?
Another issue I noticed is that after the switch I would need to click on the applet before KeyListener would work. How do I work around this?
The last question I have is if the code below is a good way to go or if there's a better way?
here's the code for the making the swich...
public void keyReleased(KeyEvent e)
{
//Gg is one the applets
Gg g = new Gg();
g.addKeyListener(g);g.setSize(300,300);
//ex is the JFrame
ex.add(g);
ex.remove(this);
ex.validate();