Can any one explain what is the usage of creating a contentpane in swing...

Recommended Answers

All 2 Replies

You don't normally create your own, but Java windows have them automatically. It just simplifies things to separate the border from the contents.
See the second part (swing) of this tutorial...
Before Java 1.5 you had to mess about adding components and setting layout managers for the content panel, but now you can ignore that and just add them to the JFrame etc.

there no reason to create ContentPane in todays > Java6, in Java5 there were added simple plain JComponent, with pre-implemnted BorderLayout, all another JComponents have got implemented FlowLayout

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.