Skip to main content

Overview

The igu package contains four main JFrame classes that comprise the application’s graphical user interface. Each frame is designed using NetBeans GUI Builder with a consistent visual style.

Inicio

Welcome screen with registration button

Registrar

Student registration form

Login

Authentication interface

Matricula

Course enrollment system

Inicio Frame

The welcome screen that serves as the application’s entry point.

Class Structure

igu/Inicio.java
package igu;

public class Inicio extends javax.swing.JFrame {
    private Registrar registrate;

    @SuppressWarnings("LeakingThisInConstructor")
    public Inicio() {
        initComponents();
        this.registrate = new Registrar();
        registrate.setIni(this);
    }
}

UI Components

ComponentTypePurpose
jPanel1JPanelMain container with AbsoluteLayout
jLabel1JLabel”BIENVENIDO A LA UNIVERSIDAD” header
btnRegistrarseJButtonNavigation to registration screen
jSeparator1JSeparatorVisual separator line
FondoPantallaJLabelBackground image label
The frame dimensions are set to 692x370 pixels with a background image overlay.

Button Action Handler

igu/Inicio.java:74
private void btnRegistrarseActionPerformed(java.awt.event.ActionEvent evt) {
    registrate.setIni(this);
    registrate.setVisible(true);
    registrate.setLocationRelativeTo(null);
    this.setVisible(false);
}

Registrar Frame

The student registration form that collects personal information.

Class Structure

igu/Registrar.java
package igu;

import javax.swing.JOptionPane;
import logica.Alumno;

public class Registrar extends javax.swing.JFrame {
    private Inicio ini;
    private Login log;
    Alumno alu = new Alumno();

    public Registrar() {
        initComponents();
        this.log = new Login();
        log.setRegis(this);
    }
}

Input Fields

1

Nombre

txtNombre - Student’s first name (JTextField)
2

Apellido

txtApellido - Student’s last name (JTextField)
3

DNI

txtDni - National identification number (JTextField)
4

Contraseña

txtContra - Account password (JTextField)

Action Buttons

Validates all fields and creates the student account:
igu/Registrar.java:207
private void btnRegistrarseActionPerformed(java.awt.event.ActionEvent evt) {
    String nombre = txtNombre.getText();
    String apellido = txtApellido.getText();
    String dni = txtDni.getText();
    String contra = txtContra.getText();
    
    if (nombre.isEmpty()) {
        JOptionPane.showMessageDialog(this, "COMPLETE SU NOMBRE", 
            "Advertencia", JOptionPane.WARNING_MESSAGE);
    } else if (apellido.isEmpty()) {
        JOptionPane.showMessageDialog(this, "COMPLETE SU APELLIDO", 
            "Advertencia", JOptionPane.WARNING_MESSAGE);
    } else if (dni.isEmpty()) {
        JOptionPane.showMessageDialog(this, "COMPLETE SU DNI", 
            "Advertencia", JOptionPane.WARNING_MESSAGE);
    } else if (contra.isEmpty()) {
        JOptionPane.showMessageDialog(this, "COMPLETE SU CONTRASEÑA", 
            "Advertencia", JOptionPane.WARNING_MESSAGE);
    } else {
        JOptionPane.showMessageDialog(null, "REGISTRO EXITOSO");
        log = new Login(dni, contra);
        log.setRegis(this);
        log.setVisible(true);
        log.setLocationRelativeTo(null);
        this.setVisible(false);
    }
}
The application performs field validation sequentially. All fields must be filled before registration succeeds.

Data Binding

Each text field has an action listener that updates the Alumno object:
igu/Registrar.java:180
private void txtNombreActionPerformed(java.awt.event.ActionEvent evt) {
    String nombre = txtNombre.getText();
    alu.setNombre(nombre);
}

private void txtApellidoActionPerformed(java.awt.event.ActionEvent evt) {
    String apellido = txtApellido.getText();
    alu.setApellido(apellido);
}

private void txtDniActionPerformed(java.awt.event.ActionEvent evt) {
    String dni = txtDni.getText();
    alu.setDni(dni);
}

private void txtContraActionPerformed(java.awt.event.ActionEvent evt) {
    String contra = txtContra.getText();
    alu.setContraseña(contra);
}

Login Frame

Authentication screen that validates student credentials.

Class Structure

igu/Login.java
package igu;

import javax.swing.JOptionPane;

public class Login extends javax.swing.JFrame {
    private Registrar regis;
    private Matricula matri;
    private String regisDni;
    private String regisContra;

    public Login() {
        this("", "");
        initComponents();
    }
    
    public Login(String regisDni, String regisContra) {
        this.regisDni = regisDni;
        this.regisContra = regisContra;
        this.matri = new Matricula();
        matri.setLog(this);
        initComponents();
    }
}
The Login frame uses constructor overloading to accept credentials from the Registrar frame.

Authentication Components

ComponentTypeDescription
txtUsuarioJTextFieldDNI input field
pswContraJPasswordFieldPassword input (masked)
btnIniciarSesionJButtonSubmit credentials
btnVolverJButtonReturn to registration
jPanel1JPanelMain form panel (dark teal)
jPanel2JPanelSide panel with logo (white)

Authentication Logic

igu/Login.java:171
private void btnIniciarSesionActionPerformed(java.awt.event.ActionEvent evt) {
    String usuario = txtUsuario.getText();
    String contra = new String(pswContra.getPassword());
    
    if (usuario.equals(regisDni) && contra.equals(regisContra)) {
        JOptionPane.showMessageDialog(null, "INICIO EXITOSO");
        matri.setLog(this);
        matri.setVisible(true);
        matri.setLocationRelativeTo(null);
        this.setVisible(false);
    } else {
        JOptionPane.showMessageDialog(this, 
            "USUARIO O CONTRASEÑA INCORRECTA", 
            "Error", 
            JOptionPane.ERROR_MESSAGE);
    }
}
Credentials are stored in plain text and validated using simple string comparison. This is suitable for educational purposes but not production use.

Layout Design

The Login frame uses a split-panel design:
  • Left Panel (240x345): White background with university logo image
  • Right Panel (350x345): Dark teal background with login form

Matricula Frame

The course enrollment interface featuring dropdown selection and table display.

Class Structure

igu/Matricula.java
package igu;

import java.util.ArrayList;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import logica.Cursos;

public final class Matricula extends javax.swing.JFrame {
    private Login log;
    
    ArrayList<Cursos> listaCursos = new ArrayList<>();
    DefaultTableModel modelo = new DefaultTableModel();
  
    public Matricula() {
        initComponents();
        modelo = new DefaultTableModel();
        modelo.addColumn("Cursos");
        refrescarTabla();
    }
}

Course Selection

The frame provides five JComboBox components for course selection:
scrMatematica.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { 
    "Ninguno", 
    "Matematica| Prof. Raúl Hernandez  | A0504  | Lun y Mie  2:00pm a 4:00pm", 
    "Matematica| Prof. Javier Paucar   | A0307  | Mar y Jue  2:00pm a 4:00pm", 
    "Matematica| Prof. Amanda Ruiz     | B0603  | Lun y Mie  4:30pm a 6:30pm", 
    "Matematica| Prof. Jose Romero     | C0504  | Mar y Jue  4:30pm a 6:30pm" 
}));

Course Management Actions

1

Add Courses

The btnMatematicas button adds selected courses to the enrollment table:
igu/Matricula.java:413
private void btnMatematicasActionPerformed(java.awt.event.ActionEvent evt) {
    Cursos curso = new Cursos();
    curso.setMatematica(scrMatematica.getSelectedItem().toString());
    curso.setHistoria(scrHistoria.getSelectedItem().toString());
    curso.setLiteratura(scrLiteratura.getSelectedItem().toString());
    curso.setCivica(scrCivica.getSelectedItem().toString());
    curso.setCiencias(scrCiencias.getSelectedItem().toString());
    listaCursos.add(curso);
    refrescarTabla();
}
2

Delete Row

Remove a single selected row from the table:
igu/Matricula.java:424
private void btnEliminar_filaActionPerformed(java.awt.event.ActionEvent evt) {
    int fila = tblMatricula.getSelectedRow();
    if (fila >= 0) {
        modelo.removeRow(fila);
    } else {
        JOptionPane.showMessageDialog(null, "Seleccionar Fila");
    }
}
3

Delete All

Clear all rows from the enrollment table:
igu/Matricula.java:433
private void btnEliminar_todoActionPerformed(java.awt.event.ActionEvent evt) {
    int fila = tblMatricula.getRowCount();
    for (int i = fila - 1; i >= 0; i--) {
        modelo.removeRow(i);
    }
}
4

Complete Enrollment

Finalize the course enrollment:
igu/Matricula.java:447
private void btnRegistrarActionPerformed(java.awt.event.ActionEvent evt) {
    JOptionPane.showMessageDialog(null, "MATRICULA COMPLETADA");
}

Table Refresh Logic

The refrescarTabla() method populates the JTable with enrolled courses:
igu/Matricula.java:368
public void refrescarTabla() {
    for (Cursos curso : listaCursos) {
        Object a[] = new Object[1];
        
        a[0] = curso.getMatematica();
        modelo.addRow(a);
        
        a[0] = curso.getHistoria();
        modelo.addRow(a);
        
        a[0] = curso.getLiteratura();
        modelo.addRow(a);
        
        a[0] = curso.getCivica();
        modelo.addRow(a);
        
        a[0] = curso.getCiencias();
        modelo.addRow(a);
    }
    
    tblMatricula.setModel(modelo);
}
The table displays all five course selections from each Cursos object as separate rows.

Common Design Patterns

All GUI frames share these design characteristics:

Color Consistency

// Dark Teal Background
jPanel1.setBackground(new java.awt.Color(0, 68, 68));

// Button Color
btnRegistrarse.setBackground(new java.awt.Color(0, 153, 153));

// White Text
jLabel1.setForeground(new java.awt.Color(255, 255, 255));

// White Separators
jSeparator1.setForeground(new java.awt.Color(255, 255, 255));

Font Styles

ElementFontSizeStyle
HeadersSegoe UI / Serif18-36ptBold
LabelsSegoe UI14ptBold
ButtonsSegoe UI12-14ptBold
HintsSegoe UI8ptItalic

Layout Management

Most frames use NetBeans’ AbsoluteLayout for precise component positioning:
jPanel1.add(btnRegistrarse, 
    new org.netbeans.lib.awtextra.AbsoluteConstraints(281, 294, 130, 40));
Parameters: (x, y, width, height)

Next Steps

Data Models

Learn about the Alumno and Cursos classes that power the GUI components

Build docs developers (and LLMs) love