• Post Reply Bookmark Topic Watch Topic
  • New Topic

component and a container

 
raja ramesh
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the main diff between a component and a container using swings ??
 
Rob Spoor
Sheriff
Posts: 20817
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Technically there isn't. JComponent is a subclass of Container, so every JComponent is also a Container.

However, in practice there is a difference. A container is a special component that is be used for storing other components only. Without any added components, it is blank and displays (nearly) nothing. JPanel is one of the best examples, but also JTabbedPane.
Components can be anything, like check boxes, labels, buttons, combo boxes, tables, lists, etc. They do have a full graphical representation of themselves.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!