//package proyect; //package agenda; import java.awt.*; import java.util.*; import java.awt.event.*; import javax.swing.*; /** * *
Title:Reporte
*Description: clase que permite generar uan tabla con unresumen de los aventos
* * @author Rodrigo Loyola && Gustavo Valdes * @version 1.0 */ public class Reportes extends JFrame implements ActionListener { /** * metodo para construir reportes */ public Reportes() { super("SECRET@RIA VIRTUAL"); lap = 0; totalLaps = 1; header = new JLabel("Reporte de eventos"); backButton = new JButton("Anteriores"); nextButton = new JButton("Siguientes"); closeButton = new JButton("Cerrar"); backButton.addActionListener(this); nextButton.addActionListener(this); closeButton.addActionListener(this); data = new Object[20][3]; columnNames = new String[3]; columnNames[0] = "Nombre"; columnNames[1] = "Mail origen"; columnNames[2] = "Mail destino"; //JTable jTable = new JTable(data, columnNames); table = new JTable(); JPanel contentPane = new JPanel(); contentPane.setLayout(new BorderLayout()); JPanel southPanel = new JPanel(); southPanel.setLayout(new GridLayout(2, 5, 10, 10)); southPanel.add(new JLabel("")); southPanel.add(new JLabel("")); southPanel.add(new JLabel("")); southPanel.add(new JLabel("")); southPanel.add(new JLabel("")); southPanel.add(new JLabel("")); southPanel.add(backButton); southPanel.add(nextButton); southPanel.add(closeButton); southPanel.add(new JLabel("")); loadContacts(); this.setContentPane(contentPane); this.getContentPane().add(header, BorderLayout.NORTH); this.getContentPane().add(table, BorderLayout.CENTER); this.getContentPane().add(southPanel, BorderLayout.SOUTH); this.setSize(750, 500); this.setVisible(true); } /** * Lee contactos */ public void loadContacts() { ABC abc = new ABC("agenda.dat"); Hashtable agenda = abc.readAgenda(); totalLaps = agenda.size() / 20; int residuo = agenda.size() % 20; if(residuo > 0) totalLaps += 1; Enumeration e = agenda.elements(); for(int j=0; j