Game Design and Programming
Changing a Applet to a JApplet what are the differences
| Posted on June 30, 2012, 8:03 p.m.
Just asking since I want to use Swing in my Applets so badly but don't know what's different about JApplets that I should know about ahead of time.
This way I can change my applet for my game into a JApplet and not have it explode in my face.
What's different about JApplets and what Methods should(n't) I be calling or overriding in them compared to normal Applets?
Reality can throw you some curve balls that statistics can't predict. Best be prepared for them. :)
| Posted on July 2, 2012, 6:44 a.m.
Straight from JavaDoc:
An extended version of java.applet.Applet that adds support for the JFC/Swing component architecture. You can find task-oriented documentation about using JApplet in The Java Tutorial, in the section How to Make Applets.
The JApplet class is slightly incompatible with java.applet.Applet. JApplet contains a JRootPane as its only child. The contentPane should be the parent of any children of the JApplet. As a convenience
add and its variants,
setLayout have been overridden to forward to the contentPane as necessary. This means you can write:
Cush - Wii Friend Code: 8824 6045 3862 1803