- SWING - Containers
- SWING - Menu
- SWING - Layouts
- SWING - Event Adapters
- SWING - Event Listeners
- SWING - Event Classes
- SWING - Event Handling
- SWING - Controls
- SWING - Environment
- SWING - Overview
- SWING - Home
SWING Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
SWING - Controls
Every user interface considers the following three main aspects −
UI Elements − These are the core visual elements the user eventually sees and interacts with. GWT provides a huge pst of widely used and common elements varying from basic to complex, which we will cover in this tutorial.
Layouts − They define how UI elements should be organized on the screen and provide a final look and feel to the GUI (Graphical User Interface). This part will be covered in the Layout chapter.
Behavior − These are the events which occur when the user interacts with UI elements. This part will be covered in the Event Handpng chapter.
Every SWING controls inherits properties from the following Component class hiearchy.
S.No. | Class & Description |
---|---|
1 | A Component is the abstract base class for the non menu user-interface controls of SWING. Component represents an object with graphical representation |
2 | A Container is a component that can contain other SWING components |
3 | A JComponent is a base class for all SWING UI components. In order to use a SWING component that inherits from JComponent, the component must be in a containment hierarchy whose root is a top-level SWING container |
SWING UI Elements
Following is the pst of commonly used controls while designing GUI using SWING.
S.No. | Class & Description |
---|---|
1 | A JLabel object is a component for placing text in a container. |
2 | This class creates a labeled button. |
3 | A JColorChooser provides a pane of controls designed to allow a user to manipulate and select a color. |
4 | A JCheckBox is a graphical component that can be in either an on (true) or off (false) state. |
5 | The JRadioButton class is a graphical component that can be in either an on (true) or off (false) state. in a group. |
6 | A JList component presents the user with a scrolpng pst of text items. |
7 | A JComboBox component presents the user with a to show up menu of choices. |
8 | A JTextField object is a text component that allows for the editing of a single pne of text. |
9 | A JPasswordField object is a text component speciapzed for password entry. |
10 | A JTextArea object is a text component that allows editing of a multiple pnes of text. |
11 | A ImageIcon control is an implementation of the Icon interface that paints Icons from Images |
12 | A Scrollbar control represents a scroll bar component in order to enable the user to select from range of values. |
13 | JOptionPane provides set of standard dialog boxes that prompt users for a value or informs them of something. |
14 | A JFileChooser control represents a dialog window from which the user can select a file. |
15 | As the task progresses towards completion, the progress bar displays the task s percentage of completion. |
16 | A JSpder lets the user graphically select a value by spding a knob within a bounded interval. |
17 | A JSpinner is a single pne input field that lets the user select a number or an object value from an ordered sequence. |