View Single Post
  #2 (permalink)  
Old 08-06-2007, 05:24 AM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,222
hardwired is on a distinguished road
Is it possible to get an applet into an application frame?
Yes. Applet extends Panel, JApplet extends Applet.
Code:
class Pseudo extends JApplet { public void init() { } public static void main(String[] args) { JApplet applet = new Pseudo(); JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().add(applet); f.setSize(400,400); f.setLocation(200,200); applet.init(); // If you override start method // applet.start(); f.setVisible(true); } }
JButton is a Swing, lightweight component.
Button is an AWT, heavyweight component.
Reply With Quote