This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
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 Java 8 in Action this week in the Java 8 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: 19556
    
  16

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: 39576
    
  27
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 - updated with new look and Ping home screen widget
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Clarification needed for top level containers
 
Similar Threads
what is top-level window ?
Dispose Window & jar
Can Panel, Scrollpane, Window be added to each other ?
tree in frame, frame in applet
swing doubt