import java.awt.*; import javax.swing.*; /** Tiny example showing the main differences in using * JApplet instead of Applet: using the content pane, * getting Java (Metal) look and feel by default, and * having BorderLayout be the default instead of FlowLayout. * */ public class JAppletExample extends JApplet { public void init() { WindowUtilities.setNativeLookAndFeel(); Container content = getContentPane(); content.setBackground(Color.white); content.setLayout(new FlowLayout()); content.add(new JButton("Button 1")); content.add(new JButton("Button 2")); content.add(new JButton("Button 3")); } }
A simple applet (JApplet) created in Swing.
Permanent link to this article: http://bangla.sitestree.com/a-simple-applet-japplet-created-in-swing/