Monday, 26 March 2012

Components and Containers in Swing

•In general every Swing GUI consists of “components” and “containers”.
•All containers are components.
•A component is a thing/object that has a visual appearance and on which user can perform events.
•A container is a object/thing which can hold other components.
•Since all containers are components, a container can hold other containers.
•Every component must be added to a container in order to display it.
•So, every Swing GUI will contain atleast one container.
•This allows for container hierarchy, in which at the top we will have “top-level containers”.

•All the Swing components are derived from the “JComponent” class except the four top level containers: JFrame, JApplet, JWindow and JDialog.
•The above four top level containers are the only heavy weight components in the Swing package.
•“JComponent“ inherits both “Container” and “Component” in AWT package.
•So, all the Swing components are built on top of the AWT components.
•The four top level containers: JFrame, JApplet, JWindow and JDialog do not inherit “JComponent“ class.
•The are two types of containers in Swing. They are:
•Top-level containers (JFrame, JApplet, JWindow and JDialog)
•Light weight containers (JPanel)


•Following are some of the examples of Swing components:
1.JLabel
2.JButton
3.JToggleButton
4.JCheckBox
5.JRadioButton
6.JComboBox
7.JList
8.JTextField
9.JScrollPane
10.JTabbedPane
11.JTree
12.JTable

6 comments:

  1. Thanks a lot very much for the high quality and results-oriented help.
    I won’t think twice to endorse your blog post to anybody who wants
    and needs support about this area. refer


    java training in chennai


    java Training in Bangalore

    ReplyDelete
  2. Ciitnoida provides Core and java training institute in

    noida
    . We have a team of experienced Java professionals who help our students learn Java with the help of Live Base Projects. The object-

    oriented, java training in noida , class-based build

    of Java has made it one of most popular programming languages and the demand of professionals with certification in Advance Java training is at an

    all-time high not just in India but foreign countries too.

    By helping our students understand the fundamentals and Advance concepts of Java, we prepare them for a successful programming career. With over 13

    years of sound experience, we have successfully trained hundreds of students in Noida and have been able to turn ourselves into an institute for best

    Java training in Noida.

    java training institute in noida
    java training in noida

    ReplyDelete
  3. Informative post indeed, I’ve being in and out reading posts regularly and I see alot of engaging people sharing things and majority of the shared information is very valuable and so, here’s my fine read.
    site url
    click here to download
    click here to reset the password
    click here gif
    click here to view

    ReplyDelete