Download presentation
Presentation is loading. Please wait.
Published byGwendoline Horton Modified over 9 years ago
1
Swing / Session1 / 1 of 30 Module Introduction Distributed Computing in Java
2
Session 1 Module 1: Introduction to SWING Module 2: Swing Components and Dialogs
3
Swing / Session1 / 3 of 30 Module 1: Introduction to SWING Objectives
4
Swing / Session1 / 4 of 30 1.1-Introduction How to create this interface?
5
Swing / Session1 / 5 of 30 JFC in NetBeans
6
Swing / Session1 / 6 of 30 AWT Support Application, Applet programming
7
Swing / Session1 / 7 of 30 AWT
8
Swing / Session1 / 8 of 30 Benefits of swing Swing components are lightweight as compared to AWT components. Swing allows Pluggable-Look-And Feel control. Borders drawn around most of the Swing components can be changed. Appearance of Swing components can be changed by either invoking methods on it, or by creating a subclass of it. Swing components don’t have to be rectangle (buttons can be round) Swing is based on the Model-View-Controller Architecture.
9
Swing / Session1 / 9 of 30 Model-View-Controller Architecture Code to maintain data. Code to represent graphics Code to control user interaction.
10
Swing / Session1 / 10 of 30 Containers 4 parts of a root pane: Glass pane Layered pane Menu bar Content pane
11
Swing / Session1 / 11 of 30 Top-Level container:Class JFrame
12
Swing / Session1 / 12 of 30 Top-Level container: Class JApplet
13
Swing / Session1 / 13 of 30 General purpose container: JPanel Intermediate container. General-purpose container for lightweight components Groups some related lightweight components.
14
Swing / Session1 / 14 of 30 Lightweight Components JLabelJTextFiels JTextArea JRadioButton JButton JCheckBox JPasswordField
15
Swing / Session1 / 15 of 30 Lightweight Components: Event handling Event handling in NetBeans
16
Swing / Session1 / 16 of 30 Lightweight Components: Event handling ObjectEventInterfaceMethod JButtonActionEventActionListeneractionPerformed() JCheckBoxActionEvent ItemEvent ActionListener ItemListener actionPerformed() itemStateChanged() JRadioButtonActionEvent ItemEvent ActionListener ItemListener actionPerformed() itemStateChanged() JTextField JTextArea ActionEvent FocusEvent ActionListener FocusListener actionPerformed() focusGained(), focusLost() JPasswordFieldActionEventActionListeneractionPerformed()
17
Swing / Session1 / 17 of 30 Module 1 Summary
18
Swing / Session1 / 18 of 30 Module 2: Swing Components and Dialogs Objectives:
19
Swing / Session1 / 19 of 30 JScrollPane class Provide a scrollable view of a component Parts of a scrollpane
20
Swing / Session1 / 20 of 30 JSlider class Event handling: java.swing.event.ChangeEvent ChangeListener public void stateChanged(ChangeEvent e)
21
Swing / Session1 / 21 of 30 javax.swing.Timer class To perform a task once, after a delay. For example, the tool tip manager uses Swing timers to determine when to show a tool tip and when to hide it. To perform a task repeatedly. For example, you might perform animation or update a component that displays progress toward a goal. Constructors: Timer ( int miliSecDelay, ActionListener listener) Common used methods
22
Swing / Session1 / 22 of 30 javax.swing.JProgressBar class A Progress bar is used to display the progess of a time consuming operation. A Timer is used to determine the amount of task completed and accordingly update the progress bar Constructors Common methods Event handling ChangeListener interface public void stateChanged(…)
23
Swing / Session1 / 23 of 30 javax.swing.JFormattedTextFi eld class Create number formatted textfield Create date formatted textfield Create customized format java.text.DateFormat java.text.NumberFormat javax.swing.text.MaskFormatter
24
Swing / Session1 / 24 of 30 javax.swing.JEditorPane class
25
Swing / Session1 / 25 of 30 javax.swing.JTextPane class
26
Swing / Session1 / 26 of 30 Dialog box Types of Dialog boxes: Modal dialog boxes Non-modal dialog boxes Pre-defined standard dialog boxes: JOptionPane class. ProgressMonitor class JColorChooser class JFileChooser class Create custom dialogs, use the JDialog class directly.
27
Swing / Session1 / 27 of 30 javax.swing.JOptionPane class title message icon buttons
28
Swing / Session1 / 28 of 30 JOptionPane class
29
Swing / Session1 / 29 of 30 javax.swing.JDialog class
30
Swing / Session1 / 30 of 30 Module 2 Summary
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.