File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes Clarification needed for top level containers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Clarification needed for top level containers" Watch "Clarification needed for top level containers" New topic
Author

Clarification needed for top level containers

Geeta Balasubramanian
Greenhorn

Joined: Jul 11, 2009
Posts: 3
Top level containers are listed as - JFrame, JWindow, JDialog, JApplet.

Applets cannot be viewed without a browser or an appletviewer. How are they considered as top level containers?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19674
    
  18

Moving to Applets.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
I don't know the canonical answer, but perhaps it's because JApplet implements the RootPaneContainer interface.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41591
    
  55
A "top level container" is a Java term for something that's not embedded inside of another Java GUI object. But just like applets run inside a native launcher (the browser), so do standalone desktop apps (inside the "java" executable).


Ping & DNS - my free Android networking tools app
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19674
    
  18

But unlike other top level containers, you can add an applet to another container like a JPanel.
Fred Hamilton
Ranch Hand

Joined: May 13, 2009
Posts: 679
Ulf's explanation generally matches my way of thinking about the situation. Just to expand on that a bit...

A JApplet is the Swing browser high level container while JFrame is the desktop high level container, if you design your GUI so that all of the components are defined on a JPanel, then you should be able to use that JPanel within a JFrame or a JApplet interchangeably, with no modifications to the application itself. The JFrame and JApplet classes would just be shells with only a few lines of code each.

Of course there are some functionalities that are meant for Desktop and not JApplet, but in general the above paragraph holds true
Geeta Balasubramanian
Greenhorn

Joined: Jul 11, 2009
Posts: 3
Thanks all!
 
wood burning stoves
 
subject: Clarification needed for top level containers