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. following are certain noticable points to be considered.
sub classes of container are called as container. for example, jpanel, jframe and jwindow.
container can add only a component to itself.
a default layout is present in each container which can be overridden using setlayout method.
swing containers
following is the list of commonly used containers while designed gui using swing.
sr.no. | container & description |
---|---|
1 |
panel
jpanel is the simplest container. it provides space in which any other component can be placed, including other panels. |
2 |
frame
a jframe is a top-level window with a title and a border. |
3 |
window
a jwindow object is a top-level window with no borders and no menubar. |