This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

swing  RSS feed

 
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
Posts: 21092
85
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
Boost this thread!