Objectives

This class combines lecture with hands-on experience (50/50), and open ended discussion that will help the developer quickly understand Graphic User Interface (GUI) development and how properly to use SWING and DataBase. How to avoid writing unresponsive GUI using SwingWorker.

Duration

4 Days.

Outline for Developing GUI with Swing API

Module 1: Containers and Layout Managers

  • Java Foundation Classes
  • An Overview of AWT
  • An Overview of Swing
  • Top-Level Containers
  • JFrame
  • Example
  • JApplet
  • Example
  • JPanel
  • Example
  • BorderLayout Manager
  • Example
  • FlowLayout Manager
  • Examole
  • CardLayot Manager
  • Example
  • Exercise

Module 2: Event Handling

  • What is an Event?
  • Delegation Model
  • Example of Delegation Model
  • Exercise
  • Handlers
  • Swing Components and Possible Events and Listeners
  • Java GUI Behavior
  • Event Adapters
  • Inner Classes
  • Member Classes
  • Example
  • Local Classes
  • Anonymous Classes
  • Example
  • Exercise

Module 3: Swing Components

  • JButton
  • Example
  • JLabel
  • Example
  • JColorChooser
  • Example
  • JCheckBox
  • Example
  • JRadioButton
  • Example
  • JOptionPane
  • Example
  • JScrollBar
  • Example
  • JToggleButton
  • JTextField
  • JTextArea
  • JEditorPane
  • Exercise

Module 4: Tables

  • Overview
  • Introduction
  • Simple Table
  • Example
  • Complex Table
  • Example
  • Table Model
  • TableModel Interface
  • AbstractTableModel Class
  • AbstractTableModel Example
  • Example: Editable Table with AbstractTableModel
  • DefaultTableModel class
  • Example: DefaultTableModel class
  • The Table Cell Render
  • getTableCellRendererComponen() Method
  • Tables and Database
  • Custom Render
  • Example
  • Sorting
  • Custom Sorting
  • Exercise

Module 5: Popup Elements

  • Dialog Box
  • Message Box
  • Example
  • Input Box
  • Example
  • Confirmation Dialog
  • Example
  • JColorChooser
  • Example
  • Popup Menu
  • Example
  • Exercise
  • Menu Bar
  • Example
  • Submenu
  • Example
  • Menu On The Right Side

Module 6: Swing and Database (DB2)

  • JDBC
  • Overview of JDBC
  • Connecting to the DataBase
  • Submitting the SQL statements
  • Retrieving and processing data
  • Data Access Object
  • Examles
  • Modify JTable from user input
  • Display all records from database table in JTable
  • Exercise

Module 7: Hierarchical Data and JTree

  • Introduction
  • Goal
  • Tree Model
  • Tree Node
  • Example 1
  • Example 2
  • Adding a Scrollpane
  • Example
  • Root Handler
  • Example
  • Adding an Event

Module 8:  Threads

  • Processes vs. Threads
  • Threads Scheduling
  • Creating a Thread
  • Starting a Thread
  • Managing a Thread
  • Synchronization
  • Example

Module 9: SwingWorker class and Multithreading

  • Introduction
  • Concurrency in Swing
  • Initial Threads
  • The Event Dispatch Thread
  • Worker Thread And SwingWorker
  • SwingWorker
  • Why Do We Need The SwingWorker
  • MultiThreading
  • The Event Dispatching Thread Problem
  • SwingWorker Solution
  • done() Method Solution
  • SwingWorker class
  • Thread in Swing
  • SwingWorker Solution Example
  • Second Example
  • Exercise

Module 10: Swing Applets

  • What is an Applet?
  • Applet Security
  • Applet Class Hierarchy
  • The Applet Life Cycle
  • Example
  • Painting
  • Appletviewer
  • Example
  • Exercise

Appendix 1: Bounded-Range Components

Appendix 2: Integrating Swing with Spring Framework