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

Clarification needed for top level containers

 
Geeta Balasubramanian
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20751
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to Applets.
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know the canonical answer, but perhaps it's because JApplet implements the RootPaneContainer interface.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Rob Spoor
Sheriff
Pie
Posts: 20751
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But unlike other top level containers, you can add an applet to another container like a JPanel.
 
Fred Hamilton
Ranch Hand
Posts: 684
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic