Assignment 1 AJP
Assignment 1 AJP
Date:
1. Explain the main differences between AWT and Swing in Java. Also discuss
the advantages of using Swing over AWT for developing graphical user
interfaces (GUIs).
2. Explain the hierarchy of Swing classes.
3. Discuss the purpose and usage of the add(), setSize(), setLayout(), and
setVisible() methods in the Component class.
4. Explain the purpose and usage of the following Swing components:
• JLabel
• JTextField
• JTextArea
• JButton
• JCheckBox
• JRadioButton
• JComboBox
• JMenu
5. Describe the following layout managers: Flow Layout, Border Layout, Card
Layout, Box Layout, Grid Layout, Gridbag Layout, Group Layout, and Spring
Layout.
6. Describe the concept of event handling in Java Swing.
7. Discuss the following event types: Action Events, Key Events, Focus Events,
Window Events, Mouse Events, and Item Events. Provide examples
illustrating the usage of each event type.
8. Explain the purpose and usage of the ActionListener, KeyListener,
FocusListener, WindowListener, MouseListener, MouseMotionListener, and
ItemListener interfaces.
9. Develop a GUI program that utilizes at least two of the above listener
interfaces to handle different types of events.
10. Develop a Java Swing program that demonstrates the usage of different
layout managers. Create a JFrame with multiple panels, each using a different
GOVERNMENT POLYTECHNIC, AHMEDABAD
DEPARTMENT OF INFORMATION TECHNOLOGY
TERM: 27/07/2023 TO 16/12/2023 [231]