Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet with JFrame Problem - please help!

 
Matt Wil
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to convert an application to an Applet. My problem is that I need to add a JFrame to my applet. My application used to call "window = new FrameSet();" where FrameSet was the JFrame(the window) of the application. My main class is called AdMakerApp. Is there any way to simply add this JFrame to my applet? I get the error that I cant add a window to a container. Below is what I have tried. Again, FrameSet refers to a JFrame. Thanks in advance!

package AdMakerApp;
import javax.swing.JApplet;
public class AdMakerApp extends JApplet{
static FrameSet window;

public void init() {
window = new FrameSet();
getContentPane().add(window);
}
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to add it; just create it and make it visible, and you'll have a free-standing window.
If what you want is for the window's contents to appear on the browser surface, then you'll need to do a little more surgery, and pack the contents of the JFrame's contentPane into the applet's contentPane instead.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic