CST205 - M5 -Ktunotes.in
CST205 - M5 -Ktunotes.in
» JFC
» The Java Foundation Classes (JFC) are a set of
GUI components which simplify the
development of desktop applications.
» The javax.swing package provides classes for
java swing API such as JButton, JTextField,
JTextArea, JRadioButton, JCheckbox,
Jmenu,JColorChooser etc.
Features of Swing 6
» Platform Independent:
» It is platform independent, the swing components
that are used to build the program are not
platform specific.
» It can be used at any platform and anywhere.
Features of Swing.. 7
» Lightweight:
» Swing components are lightweight which helps in creating the UI
lighter.
» A Swing component is said to be a lightweight component
because it written entirely in Java and does the high-level
display work itself, rather than relying on code provided by
your computer's operating system.
» Swings component allows it to plug into the operating system user
interface framework that includes the mappings for screens or
device and other user interactions like key press and mouse
movements.
Features of Swing.. 8
» Plugging:
» It has a powerful component that can be extended
to provide the support for the user interface that
helps in good look and feel to the application.
» It refers to the highly modular-based architecture
that allows it to plug into other customized
implementations and framework for user interfaces.
Features of Swing.. 9
» Manageable:
» It is easy to manage and configure.
» Its mechanism and composition pattern allows
changing the settings at run time as well.
» The uniform changes can be provided to the user
interface without doing any changes to application
code.
Features of Swing.. 10
» MVC:
» They mainly follows the concept of MVC that is
Model View Controller.
» With the help of this, we can do the changes in
one component without impacting or touching
other components.
» It is known as loosely coupled architecture as
well.
Features of Swing.. 11
» Customizable
» Swing controls can be easily customized. It can be
changed and the visual appearance of the swing
component application is independent of its internal
representation.
» Rich Controls
» Swing provides a rich set of advanced controls like Tree,
TabbedPane, slider, colorpicker, and table controls.
Hierarchy of Java Swing classes
12
The Model-View-Controller Architecture 13
» JLabel
» A JLabel object is a component for placing text in a
container.
» JButton
» This class creates a labeled button.
» JColorChooser
» A JColorChooser provides a pane of controls
designed to allow a user to manipulate and select a
color.
The list of commonly used controls while designing GUI using SWING 21
» JCheck Box
» A JCheckBox is a graphical component that can be
in either an on (true) or off (false) state.
» JRadioButton
» The JRadioButton class is a graphical component
that can be in either an on (true) or off (false)
state. in a group.
» JList
» A JList component presents the user with a scrolling
list of text items.
The list of commonly used controls while designing GUI using SWING 22
» JComboBox
» A JComboBox component presents the user with a
to show up menu of choices.
» JTextField
» A JTextField object is a text component that allows
for the editing of a single line of text.
» JPasswordField
» A JPasswordField object is a text component
specialized for password entry.
The list of commonly used controls while designing GUI using SWING 23
» JTextArea
» A JTextArea object is a text component that allows
editing of a multiple lines of text.
» ImageIcon
» A ImageIcon control is an implementation of the
Icon interface that paints Icons from Images
» JScrollbar
» A Scrollbar control represents a scroll bar
component in order to enable the user to select
from range of values.
The list of commonly used controls while designing GUI using SWING 24
» JOptionPane
» JOptionPane provides set of standard dialog boxes
that prompt users for a value or informs them of
something.
» JFileChooser
» A JFileChooser control represents a dialog window
from which the user can select a file.
» JProgressBar
» As the task progresses towards completion, the
progress bar displays the task's percentage of
completion.
The list of commonly used controls while designing GUI using SWING 25
» JSlider
» JSlider lets the user graphically select a value by
sliding a knob within a bounded interval.
» Jspinner
» A JSpinner is a single line input field that lets the
user select a number or an object value from an
ordered sequence.
Components & Containers
COMPONENTS
» java.awt.BorderLayout » javax.swing.BoxLayout
» java.awt.FlowLayout » javax.swing.GroupLay
» java.awt.GridLayout out
» java.awt.CardLayout » javax.swing.ScrollPane
Layout
» java.awt.GridBagLayo
ut » javax.swing.SpringLay
out etc.
18
19
20
21
22
23