SOLID, Swing, Events & JDBC
Clean OOP design using all five SOLID principles, desktop GUI architecture with Swing & MVC Model-Delegate, the Delegation Event Model, all five Swing Layout Managers, and conceptual JDBC architecture, drivers, components, and connectivity steps (Theory Only).
Section 1: SOLID Principles in Java
SOLID Principles (Part 1): Single Responsibility (SRP) & Open/Closed (OCP)
Writing Java code that merely compiles is easy—writing OOP code that stays clean and adaptable when requirements change six months later is hard! Robert C. Martin's SOLID Principles are five foundational OOP design guidelines that prevent bloated 'God classes', rigid if-else chains, and fragile dependencies. In Module 4 exams, expect dedicated 6-mark and 9-mark questions asking for definitions, analogies, and Bad vs Good Java designs.
SOLID Principles (Part 2): Liskov Substitution (LSP), Interface Segregation (ISP) & Dependency Inversion (DIP)
The remaining three SOLID principles ensure your inheritance trees don't lie (LSP), your interfaces don't force unused dummy methods (ISP), and your high-level business logic doesn't lock itself onto concrete hardware/database classes (DIP). Together with SRP and OCP, these complete Section 1 of Module 4.
Section 2: Swings Fundamentals
Overview of AWT, Introduction to Swing, Key Features & Swing vs AWT
Before Java introduced Swing in J2SE 1.2 (1998), desktop graphical user interfaces (GUIs) relied solely on AWT (Abstract Window Toolkit). Understanding why AWT fell short (heavyweight native OS peers) and how Swing fixed those limitations (lightweight components + pluggable look-and-feel) gives you guaranteed marks in Module 4.
MVC & Swing Model-Delegate Architecture, Containers, Root Panes & Component Hierarchy
How does Swing let you change the look and feel of every button at runtime without altering your event code? And how does Swing organize windows, panels, and menu bars inside a single frame? The answers lie in two cornerstone exam architectures: Swing's Model-Delegate MVC and the Containment & Top-Level Container Panes Hierarchy.
Exploring Swing Controls: `JFrame`, `JLabel`, `JTextField` & Swing Buttons
This topic dives straight into the core Swing widgets listed in the KTU syllabus—covering exact constructors, methods, inheritance parents, and events fired by JFrame, JLabel (with ImageIcon), JTextField, and all four Swing Buttons (JButton, JToggleButton, JCheckBox, JRadioButton + ButtonGroup).
Section 3: Event Handling in Swing
Event Handling Mechanisms & the Delegation Event Model
Desktop GUIs are event-driven: unlike console programs that read line 1 then exit, a Swing window sits calmly waiting until a user clicks a button, types a key, or moves the mouse. In modern Java (JDK 1.1 onward), all AWT and Swing events follow the Delegation Event Model—one of the highest-yield 6-mark and 9-mark diagram questions in Module 4.
Event Classes (`EventObject`, `ActionEvent`, `MouseEvent`, `KeyEvent`) & Listener Interfaces
What exact information does Java hand your listener when a button is clicked, a key is pressed, or a mouse is dragged? It hands you specialized Event Objects descending from java.util.EventObject and java.awt.AWTEvent. Knowing the major Event Classes, their methods, and their paired Listener Interfaces is essential for both theory questions and event-handling code writing.
Section 4: Swing Layout Managers
Swing Layout Managers (Part 1): Need, `FlowLayout`, `BorderLayout` & `GridLayout`
What happens if you position buttons using hardcoded pixel coordinates (x=120, y=50) and a user resizes the window or switches from Windows to Linux with larger fonts? Components overlap or vanish off-screen! Java solves responsive UI positioning using Layout Managers—starting with the three everyday workhorses: FlowLayout, BorderLayout, and GridLayout.
Swing Layout Managers (Part 2): `CardLayout`, `GridBagLayout` & Complete Comparison
When simple flows, 5-zone borders, and uniform grids aren't flexible enough—such as building a multi-step wizard showing one panel at a time (CardLayout), or designing an asymmetric form where a text area spans 2 columns and stretches proportionally (GridBagLayout)—Swing offers two advanced layout managers.
Section 5: JDBC – Theory Only
JDBC Overview, 2-Tier & 3-Tier Architecture and All 4 JDBC Driver Types
Java programs often need to communicate with relational databases such as Oracle, PostgreSQL, or MySQL—each of which speaks its own binary network protocol. JDBC (Java Database Connectivity) solves this by offering one standard, database-independent Java API (java.sql), paired with pluggable vendor drivers so your Java code stays portable across databases!
Common JDBC Components (`DriverManager`, `Connection`, `Statement`, `PreparedStatement`, `CallableStatement`, `ResultSet`) & 6 Connectivity Steps
Whether a Java program talks to MySQL, PostgreSQL, or Oracle, every database interaction uses the exact same core interfaces in java.sql and follows the exact same 6-step JDBC connectivity lifecycle. Mastering the role of each component (DriverManager, Connection, Statement vs PreparedStatement vs CallableStatement, ResultSet, SQLException) and drawing the 6-step sequence secures full marks on Module 4's final Part B section.