Contact Management App is a Java Swing desktop application that organizes personal and professional contacts, providing CRUD operations, CSV import/export, multilingual support, and live statistics charts. The entire codebase follows a classic Model-View-Controller structure, enforced through Java package boundaries and a strict separation of concerns: the model never references Swing, the view never holds business logic, and the controller owns all event wiring and concurrency.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/efrain-svg/Potes_Freddy_ProgInterfacesG_U3/llms.txt
Use this file to discover all available pages before exploring further.
Package structure
The source tree undersrc/ maps one-to-one with the three MVC layers plus a set of view-support utilities.
| Package | Files | Role |
|---|---|---|
modelo | persona.java, personaDAO.java | Entity and data-access layer |
vista | ventana.java | Main application window (view) |
controlador | logica_ventana.java | Event handling and business logic (controller) |
vista.theme | ThemeManager.java, SvgIconLoader.java | Look-and-feel setup and icon loading |
vista.i18n | I18n.java | Internationalization / ResourceBundle wrapper |
vista.charts | BarChartPanel.java, PieChartPanel.java | Custom painted statistics panels |
src
modelo
persona.java
personaDAO.java
vista
ventana.java
theme
ThemeManager.java
SvgIconLoader.java
i18n
I18n.java
charts
BarChartPanel.java
PieChartPanel.java
controlador
logica_ventana.java
Module interaction
The following table traces the primary runtime interactions between modules:| From | To | Interaction |
|---|---|---|
ventana (view) | ThemeManager | Calls setupLookAndFeel() before the window is created |
ventana (view) | logica_ventana | Instantiates the controller and passes this as the delegate |
logica_ventana (controller) | ventana | Reads public fields to wire listeners and update UI state |
logica_ventana (controller) | personaDAO | Calls load, save, update, and export methods |
logica_ventana (controller) | I18n | Fetches translated strings for all UI labels |
personaDAO (data access) | persona | Reads datosContacto() to serialize; constructs instances when loading |
ventana (view) | BarChartPanel / PieChartPanel | Embeds chart panels in the Statistics tab |
ventana (view) | SvgIconLoader | Loads SVG icons for toolbar buttons |
Technology stack
Java 17
Core runtime. Uses
java.time.LocalDate, java.util.concurrent locks and executors, and java.util.ResourceBundle for i18n.Java Swing
UI toolkit.
JFrame, JTable with TableRowSorter, JTabbedPane, GridBagLayout, BorderLayout, and InputMap/ActionMap for keyboard shortcuts.FlatLaf 3.6
Third-party Swing look-and-feel that replaces the default Metal/Nimbus theme with a modern flat UI. Applied once at startup via
ThemeManager.SwingWorker
Built-in concurrency bridge. Used for all disk I/O (loading, searching, duplicate checking) to keep the Event Dispatch Thread responsive.
ExecutorService
java.util.concurrent.ExecutorService with dedicated thread pools for CSV export (2 threads) and UI notifications (1 thread).CSV flat-file storage
No database dependency. Contacts are persisted as semicolon-delimited CSV at
c:/gestionContactos/datosContactos.csv with RFC 4180 escaping.Key design decisions
Why FlatLaf instead of the default Look and Feel?
Why FlatLaf instead of the default Look and Feel?
Java’s built-in themes (Metal, Nimbus) look dated on modern operating systems. FlatLaf provides a flat, cross-platform UI that renders consistently on Windows, macOS, and Linux without requiring platform-specific LAF detection. It is applied once, before any Swing component is created, in
ThemeManager.setupLookAndFeel().Why SwingWorker for disk I/O?
Why SwingWorker for disk I/O?
Swing is single-threaded: all component updates must happen on the Event Dispatch Thread (EDT). Reading or writing a CSV file on the EDT freezes the UI until the operation completes.
SwingWorker moves blocking work to a background thread and then marshals results back to the EDT in done() / process(), keeping the application responsive even with large contact lists.Why ResourceBundle (I18n) instead of hard-coded strings?
Why ResourceBundle (I18n) instead of hard-coded strings?
The application targets Spanish, English, and Portuguese speakers. Centralizing all display strings in
I18n (backed by ResourceBundle) means every label, button, and error message can be switched at runtime by calling aplicarIdioma(String) in the controller—no UI rebuild required. It also makes adding new locales a matter of providing a new properties file rather than touching source code.Why ReentrantLock instead of synchronized blocks?
Why ReentrantLock instead of synchronized blocks?
The controller manages three separate locks—
contactosLock, exportLock, and editLock—because different operations compete over different shared resources. ReentrantLock provides explicit, named locking that makes the concurrency model visible in the code and allows lock-interruptible waits, which is useful for the export executor where a long-running export should not block an unrelated edit.Why expose public fields in the view instead of getters?
Why expose public fields in the view instead of getters?
ventana.java exposes all interactive Swing components as public fields. This is a deliberate trade-off: in a tightly scoped desktop application where the view and controller are always compiled together, public field access eliminates the boilerplate of dozens of trivial getters while keeping all event-wiring logic in one place (logica_ventana.configurarEventos()). The view remains a pure UI assembly class with no business logic.Why CSV instead of a relational database?
Why CSV instead of a relational database?
A flat CSV file has zero deployment overhead—no database server, no connection pool, no migration scripts. For a single-user desktop contact manager the data volume is low and a semicolon-delimited file is human-readable and directly importable into spreadsheet tools. The DAO layer (
personaDAO) encapsulates all file access so the storage format can be changed without touching the model or controller.Related pages
MVC pattern implementation
How each MVC layer is defined, how the view exposes components, and how the controller wires events.
Contact data model
The
persona entity fields, constructors, CSV serialization, and personaDAO method reference.