Difference between components and container in swing?
Answers
Answer:
The difference between the two is found in their intended purpose: As the term is commonly used, a component is an independent visual control, such as a push button or slider. A container holds a group of components. Thus, a container is a special type of component that is designed to hold other components.
Explanation:
SwingApplication creates four commonly used Swing . components:
. a frame, or main window ( JFrame )
. a panel, sometimes called a pane ( JPanel )
. a button ( JButton )
. a label ( JLabel )
Containers are an integral part of SWING GUI components. A container provides a space where a component can be located. A Container in AWT is a component itself and it provides the capability to add a component to itself. ... Sub classes of Container are called as Container. For example, JPanel, JFrame and JWindow.