• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

swing

 
thanvi janu
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
difference between JPanel, JFrame and Container
 
Rob Spoor
Sheriff
Pie
Posts: 20661
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please Use A Meaningful Subject Line. About 90% of all threads in this forum is about Swing.

As for an answer:
- A JFrame is a subclass of Frame which is a subclass of Window. It is meant to be a toplevel component, meaning it is its own window.
- A JPanel is a container that must be put in another container or window. Without a parent window (either directly or indirectly; dialogs are windows too) it cannot be displayed.
- A Container is an AWT class and should therefore not be used in Swing. A JPanel is an indirect subclass of Container so use JPanel instead.

Also check out the Javadoc pages of all three and their super classes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic