subida completa avance 2da entrega
This commit is contained in:
Binary file not shown.
BIN
bin/utiles/ControlLogin.class
Normal file
BIN
bin/utiles/ControlLogin.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
bin/visual/Login$1.class
Normal file
BIN
bin/visual/Login$1.class
Normal file
Binary file not shown.
BIN
bin/visual/Login$2.class
Normal file
BIN
bin/visual/Login$2.class
Normal file
Binary file not shown.
BIN
bin/visual/Login$3.class
Normal file
BIN
bin/visual/Login$3.class
Normal file
Binary file not shown.
BIN
bin/visual/Login.class
Normal file
BIN
bin/visual/Login.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/visual/Registro$1.class
Normal file
BIN
bin/visual/Registro$1.class
Normal file
Binary file not shown.
BIN
bin/visual/Registro$2.class
Normal file
BIN
bin/visual/Registro$2.class
Normal file
Binary file not shown.
BIN
bin/visual/Registro.class
Normal file
BIN
bin/visual/Registro.class
Normal file
Binary file not shown.
@@ -14,19 +14,33 @@ public class Archivo
|
||||
BufferedReader br;
|
||||
FileWriter fw;
|
||||
|
||||
public Archivo(String ruta)
|
||||
public Archivo(String archivo)
|
||||
{
|
||||
String ruta = getRuta(archivo);
|
||||
try
|
||||
{
|
||||
archivo = new File(ruta);
|
||||
if (!archivo.exists())
|
||||
this.archivo = new File(ruta);
|
||||
if (!this.archivo.exists())
|
||||
{
|
||||
archivo.createNewFile();
|
||||
this.archivo.createNewFile();
|
||||
}
|
||||
} catch (Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
public String getRuta(String archivo)
|
||||
{
|
||||
String ruta = "";
|
||||
String os = System.getProperty("os.name");
|
||||
if (os.contains("Windows"))
|
||||
{
|
||||
ruta = "C:\\P.A.M\\" + archivo;
|
||||
} else if (os.contains("Linux"))
|
||||
{
|
||||
ruta = System.getProperty("user.home") + "/P.A.M/" + archivo;
|
||||
}
|
||||
return ruta;
|
||||
}
|
||||
public String leerArchivo()
|
||||
{
|
||||
abrirLeer();
|
||||
@@ -66,19 +80,19 @@ public class Archivo
|
||||
public void borrarLinea(String id)
|
||||
{
|
||||
String[] arch = entregarProcesado();
|
||||
for(int x = 0; x < arch.length; x++)
|
||||
for (int x = 0; x < arch.length; x++)
|
||||
{
|
||||
if(arch[x].split(";")[0].equals(id))
|
||||
if (arch[x].split(";")[0].equals(id))
|
||||
{
|
||||
arch[x]="";
|
||||
arch[x] = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
String[] nArch = new String[arch.length-1];
|
||||
int z =0;
|
||||
for(int x = 0; x < arch.length; x++)
|
||||
String[] nArch = new String[arch.length - 1];
|
||||
int z = 0;
|
||||
for (int x = 0; x < arch.length; x++)
|
||||
{
|
||||
if(arch[x].length()>1)
|
||||
if (arch[x].length() > 1)
|
||||
{
|
||||
nArch[z] = arch[x];
|
||||
z++;
|
||||
@@ -90,12 +104,14 @@ public class Archivo
|
||||
{
|
||||
clearFile();
|
||||
abrirEscribir();
|
||||
for(int x = 0; x < texto.length;x++)
|
||||
for (int x = 0; x < texto.length; x++)
|
||||
{
|
||||
try
|
||||
{
|
||||
fw.append(texto[x]+"*!");
|
||||
} catch (IOException e){}
|
||||
fw.append(texto[x] + "*!");
|
||||
} catch (IOException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
cerrarEscribir();
|
||||
}
|
||||
|
||||
70
src/utiles/ControlLogin.java
Normal file
70
src/utiles/ControlLogin.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package utiles;
|
||||
|
||||
public class ControlLogin extends Archivo
|
||||
{
|
||||
public ControlLogin()
|
||||
{
|
||||
super("userData");
|
||||
}
|
||||
public boolean añadirUsuario(String user, String pass, String pass2)
|
||||
{
|
||||
if (!isUser(user))
|
||||
{
|
||||
if (user.length() > 4)
|
||||
{
|
||||
if (pass.equals(pass2))
|
||||
{
|
||||
if (pass.length() > 6)
|
||||
{
|
||||
escribirArchivo(user + ";" + pass);
|
||||
return true;
|
||||
} else
|
||||
{
|
||||
javax.swing.JOptionPane.showMessageDialog(null, "La contraseña es muy corta", null,
|
||||
javax.swing.JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
javax.swing.JOptionPane.showMessageDialog(null, "Las contraseñas no son iguales", null,
|
||||
javax.swing.JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
javax.swing.JOptionPane.showMessageDialog(null, "El usuario es muy corto", null,
|
||||
javax.swing.JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
javax.swing.JOptionPane.showMessageDialog(null, "El usuario ya existe ", null,
|
||||
javax.swing.JOptionPane.ERROR_MESSAGE);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public boolean isUser(String user)
|
||||
{
|
||||
String[] arch = entregarProcesado();
|
||||
for (int x = 0; x < arch.length; x++)
|
||||
{
|
||||
if (arch[x].split(";")[0].equals(user))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public boolean isUserPass(String user,String pass)
|
||||
{
|
||||
String[] arch = entregarProcesado();
|
||||
for(int x = 0; x < arch.length; x++)
|
||||
{
|
||||
if(arch[x].split(";")[0].equals(user)&&arch[x].split(";")[1].equals(pass))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3,23 +3,18 @@ package utiles;
|
||||
import java.time.YearMonth;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ControlPrincipal
|
||||
public class ControlPrincipal extends Archivo
|
||||
{
|
||||
private String ruta;
|
||||
private String usuario;
|
||||
private Archivo archivo;
|
||||
|
||||
public ControlPrincipal(String usuario)
|
||||
{
|
||||
this.usuario = usuario;
|
||||
getRuta();
|
||||
archivo = new Archivo(ruta);
|
||||
super(usuario);
|
||||
}
|
||||
public void añadir(String fecha, String documento, String fd, String desc, String ing, String egr)
|
||||
{
|
||||
int id = 1;
|
||||
int saldo = 0;
|
||||
String[] arch = archivo.entregarProcesado();
|
||||
String[] arch = entregarProcesado();
|
||||
String[] lastRow = arch[arch.length - 1].split(";");
|
||||
try
|
||||
{
|
||||
@@ -29,11 +24,11 @@ public class ControlPrincipal
|
||||
{
|
||||
}
|
||||
String fila = id + ";" + fecha + ";" + documento + ";" + fd + ";" + desc + ";" + ing + ";" + egr + ";" + saldo;
|
||||
archivo.escribirArchivo(fila);
|
||||
escribirArchivo(fila);
|
||||
}
|
||||
public void modificarFila(String id, String fecha, String documento, String fd, String desc, String ing, String egr)
|
||||
{
|
||||
String[] arch = archivo.entregarProcesado();
|
||||
String[] arch = entregarProcesado();
|
||||
for (int x = 0; x < arch.length; x++)
|
||||
{
|
||||
if (arch[x].split(";")[0].equals(id))
|
||||
@@ -43,16 +38,16 @@ public class ControlPrincipal
|
||||
}
|
||||
}
|
||||
actSaldos();
|
||||
archivo.actArchivo(arch);
|
||||
actArchivo(arch);
|
||||
}
|
||||
public void eliminarFila(String id)
|
||||
{
|
||||
archivo.borrarLinea(id);
|
||||
borrarLinea(id);
|
||||
actSaldos();
|
||||
}
|
||||
public void actSaldos()
|
||||
{
|
||||
String[] arch = archivo.entregarProcesado();
|
||||
String[] arch = entregarProcesado();
|
||||
for (int x = 0; x < arch.length; x++)
|
||||
{
|
||||
int saldoAnterior = 0;
|
||||
@@ -75,33 +70,33 @@ public class ControlPrincipal
|
||||
textAux += saldo;
|
||||
arch[x] = textAux;
|
||||
}
|
||||
archivo.actArchivo(arch);
|
||||
actArchivo(arch);
|
||||
}
|
||||
public String[] getLastRow()
|
||||
{
|
||||
String[] arch = archivo.entregarProcesado();
|
||||
String[] arch = entregarProcesado();
|
||||
return arch[arch.length - 1].split(";");
|
||||
}
|
||||
public String[] getRow(int id)
|
||||
{
|
||||
String[] arch = archivo.entregarProcesado();
|
||||
String[] arch = entregarProcesado();
|
||||
return arch[id].split(";");
|
||||
}
|
||||
public int getRowCount()
|
||||
{
|
||||
String[] arch = archivo.entregarProcesado();
|
||||
String[] arch = entregarProcesado();
|
||||
return arch.length;
|
||||
}
|
||||
public boolean isFiled()
|
||||
{
|
||||
return (archivo.leerArchivo().length() > 1);
|
||||
return (leerArchivo().length() > 1);
|
||||
}
|
||||
public String[][] resumenMes()
|
||||
{
|
||||
String[][] fin = new String[4][1];
|
||||
if (archivo.leerArchivo().length() > 5)
|
||||
if (leerArchivo().length() > 5)
|
||||
{
|
||||
String[] arch = archivo.entregarProcesado();
|
||||
String[] arch = entregarProcesado();
|
||||
ArrayList<String> fechas = new ArrayList<String>();
|
||||
ArrayList<String> ings = new ArrayList<String>();
|
||||
ArrayList<String> egrs = new ArrayList<String>();
|
||||
@@ -174,9 +169,9 @@ public class ControlPrincipal
|
||||
}
|
||||
public int[] resumenDoc()
|
||||
{
|
||||
String[] arch = archivo.entregarProcesado();
|
||||
String[] arch = entregarProcesado();
|
||||
int[] docs = { 0, 0, 0};
|
||||
if (archivo.leerArchivo().length() > 5)
|
||||
if (leerArchivo().length() > 5)
|
||||
{
|
||||
for (int x = 0; x < arch.length; x++)
|
||||
{
|
||||
@@ -197,15 +192,5 @@ public class ControlPrincipal
|
||||
}
|
||||
return docs;
|
||||
}
|
||||
public void getRuta()
|
||||
{
|
||||
String os = System.getProperty("os.name");
|
||||
if (os.contains("Windows"))
|
||||
{
|
||||
this.ruta = "C:\\P.A.M\\archivo";
|
||||
} else if (os.contains("Linux"))
|
||||
{
|
||||
this.ruta = System.getProperty("user.home") + "/P.A.M/" + this.usuario;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
189
src/visual/Login.java
Normal file
189
src/visual/Login.java
Normal file
@@ -0,0 +1,189 @@
|
||||
package visual;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.GroupLayout;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.LayoutStyle;
|
||||
import javax.swing.WindowConstants;
|
||||
|
||||
import utiles.ControlLogin;
|
||||
|
||||
public class Login{
|
||||
|
||||
private JFrame frame;
|
||||
private JLabel Ingresar;
|
||||
private JButton bIngresar;
|
||||
private JButton bRegistrar;
|
||||
private JButton bSalir;
|
||||
private JLabel bienvenido;
|
||||
private JPasswordField fPass;
|
||||
private JTextField fUser;
|
||||
private JLabel lPass;
|
||||
private JLabel lUser;
|
||||
private JPanel panel;
|
||||
|
||||
public Login() {
|
||||
initComponents();
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
|
||||
frame = new JFrame();
|
||||
panel = new JPanel();
|
||||
Ingresar = new JLabel();
|
||||
bienvenido = new JLabel();
|
||||
bIngresar = new JButton();
|
||||
bSalir = new JButton();
|
||||
fUser = new JTextField();
|
||||
lUser = new JLabel();
|
||||
lPass = new JLabel();
|
||||
fPass = new JPasswordField();
|
||||
bRegistrar = new JButton();
|
||||
|
||||
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
|
||||
panel.setBackground(new Color(21, 21, 21));
|
||||
|
||||
Ingresar.setBackground(new Color(0, 204, 204));
|
||||
Ingresar.setFont(new Font("Eras Light ITC", 2, 48)); // NOI18N
|
||||
Ingresar.setForeground(new Color(0, 204, 204));
|
||||
Ingresar.setText("Ingresar!");
|
||||
|
||||
bienvenido.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
||||
bienvenido.setForeground(new Color(255, 255, 255));
|
||||
bienvenido.setText("Bienvenido de nuevo a P.A.M!");
|
||||
|
||||
bIngresar.setText("Ingresar");
|
||||
bIngresar.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
bIngresarActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
bSalir.setText("Salir");
|
||||
bSalir.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
bSalirActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
lUser.setFont(new Font("Eras Light ITC", 0, 18)); // NOI18N
|
||||
lUser.setForeground(new Color(0, 204, 204));
|
||||
lUser.setText("Usuario");
|
||||
|
||||
lPass.setBackground(new Color(0, 204, 204));
|
||||
lPass.setFont(new Font("Eras Light ITC", 0, 18)); // NOI18N
|
||||
lPass.setForeground(new Color(0, 204, 204));
|
||||
lPass.setText("Contraseña");
|
||||
|
||||
bRegistrar.setText("Registrarse");
|
||||
bRegistrar.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
bRegistrarActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
GroupLayout panelCartola1Layout = new GroupLayout(panel);
|
||||
panel.setLayout(panelCartola1Layout);
|
||||
panelCartola1Layout.setHorizontalGroup(
|
||||
panelCartola1Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelCartola1Layout.createSequentialGroup()
|
||||
.addContainerGap(267, Short.MAX_VALUE)
|
||||
.addGroup(panelCartola1Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||
.addComponent(bienvenido)
|
||||
.addGroup(panelCartola1Layout.createSequentialGroup()
|
||||
.addGroup(panelCartola1Layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(Ingresar, GroupLayout.PREFERRED_SIZE, 215, GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(panelCartola1Layout.createSequentialGroup()
|
||||
.addGroup(panelCartola1Layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
|
||||
.addGroup(panelCartola1Layout.createSequentialGroup()
|
||||
.addGap(52, 52, 52)
|
||||
.addComponent(lUser))
|
||||
.addGroup(panelCartola1Layout.createSequentialGroup()
|
||||
.addGap(34, 34, 34)
|
||||
.addComponent(lPass))
|
||||
.addComponent(fUser)
|
||||
.addGroup(panelCartola1Layout.createSequentialGroup()
|
||||
.addComponent(bIngresar, GroupLayout.PREFERRED_SIZE, 78, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(bSalir, GroupLayout.DEFAULT_SIZE, 77, Short.MAX_VALUE))
|
||||
.addComponent(fPass))
|
||||
.addGap(38, 38, 38)))
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 107, Short.MAX_VALUE)
|
||||
.addComponent(bRegistrar, GroupLayout.PREFERRED_SIZE, 115, GroupLayout.PREFERRED_SIZE)))
|
||||
.addContainerGap())
|
||||
);
|
||||
panelCartola1Layout.setVerticalGroup(
|
||||
panelCartola1Layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||
.addGroup(panelCartola1Layout.createSequentialGroup()
|
||||
.addGap(32, 32, 32)
|
||||
.addComponent(Ingresar, GroupLayout.PREFERRED_SIZE, 59, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addComponent(bienvenido, GroupLayout.PREFERRED_SIZE, 35, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(lUser)
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(fUser, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(lPass)
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(fPass, GroupLayout.PREFERRED_SIZE, 32, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(35, 35, 35)
|
||||
.addGroup(panelCartola1Layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(bSalir)
|
||||
.addComponent(bIngresar))
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 97, Short.MAX_VALUE)
|
||||
.addComponent(bRegistrar)
|
||||
.addContainerGap())
|
||||
);
|
||||
|
||||
GroupLayout layout = new GroupLayout(frame.getContentPane());
|
||||
frame.getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||
.addComponent(panel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||
.addComponent(panel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
);
|
||||
frame.getRootPane().setDefaultButton(bIngresar);
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
private void bIngresarActionPerformed(ActionEvent evt) {
|
||||
ControlLogin control = new ControlLogin();
|
||||
if(control.isUserPass(fUser.getText(), String.valueOf(fPass.getPassword())))
|
||||
{
|
||||
Principal principal = new Principal(fUser.getText());
|
||||
frame.dispose();
|
||||
}else
|
||||
{
|
||||
javax.swing.JOptionPane.showMessageDialog(null, "Usuario o contraseña incorrectas", null,
|
||||
javax.swing.JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
private void bSalirActionPerformed(ActionEvent evt) {
|
||||
System.exit(0);
|
||||
}
|
||||
private void bRegistrarActionPerformed(ActionEvent evt) {
|
||||
Registro registro = new Registro();
|
||||
frame.dispose();
|
||||
}
|
||||
public static void main(String args[]) {
|
||||
|
||||
Login ventana = new Login();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +1,16 @@
|
||||
package visual;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.CardLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.SystemColor;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.GroupLayout;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JToggleButton;
|
||||
import javax.swing.LayoutStyle;
|
||||
import javax.swing.WindowConstants;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.*;
|
||||
import org.jdesktop.swingx.JXDatePicker;
|
||||
import org.jfree.chart.ChartFactory;
|
||||
import org.jfree.chart.ChartPanel;
|
||||
import org.jfree.chart.JFreeChart;
|
||||
import org.jfree.chart.*;
|
||||
import org.jfree.chart.plot.PlotOrientation;
|
||||
import org.jfree.data.category.DefaultCategoryDataset;
|
||||
import utiles.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import utiles.ControlPrincipal;
|
||||
|
||||
public class Principal
|
||||
{
|
||||
@@ -118,6 +93,7 @@ public class Principal
|
||||
private String usuario;
|
||||
private DefaultCategoryDataset dataSetMes;
|
||||
private DefaultCategoryDataset dataSetDoc;
|
||||
|
||||
public Principal(String usuario)
|
||||
{
|
||||
this.usuario = usuario;
|
||||
@@ -875,6 +851,8 @@ public class Principal
|
||||
.addGap(0, 0, 0).addComponent(panel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
|
||||
Short.MAX_VALUE)));
|
||||
principal.pack();
|
||||
principal.setLocationRelativeTo(null);
|
||||
principal.setVisible(true);
|
||||
}
|
||||
private void resumenActionPerformed(ActionEvent evt)
|
||||
{
|
||||
@@ -1096,9 +1074,4 @@ public class Principal
|
||||
dataSetDoc.setValue(resumen[1], "Saldo", "Transferencia");
|
||||
dataSetDoc.setValue(resumen[2], "Saldo", "Credito");
|
||||
}
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Principal ventana = new Principal("Prueba3");
|
||||
ventana.principal.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
package visual;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.time.YearMonth;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import org.jfree.chart.ChartFactory;
|
||||
import org.jfree.chart.ChartPanel;
|
||||
import org.jfree.chart.JFreeChart;
|
||||
import org.jfree.chart.plot.PlotOrientation;
|
||||
import org.jfree.data.category.DefaultCategoryDataset;
|
||||
import org.jfree.data.time.Day;
|
||||
import org.jfree.data.time.TimeSeries;
|
||||
import org.jfree.data.time.TimeSeriesCollection;
|
||||
|
||||
public class Prueba
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
JFrame principal = new JFrame();
|
||||
JPanel main = new JPanel();
|
||||
principal.add(main);
|
||||
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
|
||||
dataset.setValue(6, "Profit", "Jane");
|
||||
dataset.setValue(7, "Profit", "Tom");
|
||||
dataset.setValue(8, "Profit", "Jill");
|
||||
dataset.setValue(5, "Profit", "John");
|
||||
dataset.setValue(12, "Profit", "Fred");
|
||||
JFreeChart chart = ChartFactory.createBarChart("Comparison between Salesman",
|
||||
"Salesman", "Profit", dataset, PlotOrientation.VERTICAL,
|
||||
false, true, false);
|
||||
ChartPanel graph = new ChartPanel(chart);
|
||||
main.add(graph);
|
||||
principal.pack();
|
||||
principal.setVisible(true);
|
||||
}
|
||||
}
|
||||
161
src/visual/Registro.java
Normal file
161
src/visual/Registro.java
Normal file
@@ -0,0 +1,161 @@
|
||||
package visual;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import javax.swing.*;
|
||||
|
||||
import utiles.ControlLogin;
|
||||
|
||||
public class Registro
|
||||
{
|
||||
private JFrame frame;
|
||||
private JButton bRegister;
|
||||
private JButton bSalir;
|
||||
private JLabel bienvenido;
|
||||
private JPasswordField fPass;
|
||||
private JPasswordField fPass2;
|
||||
private JTextField fUser;
|
||||
private JLabel lPass;
|
||||
private JLabel lPass2;
|
||||
private JLabel lUser;
|
||||
private JPanel panel;
|
||||
private JLabel registrarse;
|
||||
private JPanel registro;
|
||||
|
||||
public Registro()
|
||||
{
|
||||
initComponents();
|
||||
}
|
||||
private void initComponents()
|
||||
{
|
||||
frame = new JFrame();
|
||||
panel = new JPanel();
|
||||
registro = new JPanel();
|
||||
registrarse = new JLabel();
|
||||
bienvenido = new JLabel();
|
||||
bRegister = new JButton();
|
||||
bSalir = new JButton();
|
||||
fUser = new JTextField();
|
||||
lUser = new JLabel();
|
||||
lPass = new JLabel();
|
||||
lPass2 = new JLabel();
|
||||
fPass = new JPasswordField();
|
||||
fPass2 = new JPasswordField();
|
||||
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
frame.setResizable(false);
|
||||
panel.setBackground(new Color(204, 204, 204));
|
||||
panel.setRequestFocusEnabled(false);
|
||||
panel.setLayout(new CardLayout());
|
||||
registro.setBackground(new Color(21, 21, 21));
|
||||
registrarse.setBackground(new Color(0, 204, 204));
|
||||
registrarse.setFont(new Font("Eras Light ITC", 2, 48)); // NOI18N
|
||||
registrarse.setForeground(new Color(0, 204, 204));
|
||||
registrarse.setText("Registrarse!");
|
||||
bienvenido.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
||||
bienvenido.setForeground(new Color(255, 255, 255));
|
||||
bienvenido.setText("Bienvenido a P.A.M!");
|
||||
bRegister.setText("Registrarse");
|
||||
bRegister.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent evt)
|
||||
{
|
||||
bRegisterActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
bSalir.setText("Salir");
|
||||
bSalir.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent evt)
|
||||
{
|
||||
bSalirActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
lUser.setFont(new Font("Eras Light ITC", 0, 18)); // NOI18N
|
||||
lUser.setForeground(new Color(0, 204, 204));
|
||||
lUser.setText("Usuario");
|
||||
lPass.setBackground(new Color(0, 204, 204));
|
||||
lPass.setFont(new Font("Eras Light ITC", 0, 18)); // NOI18N
|
||||
lPass.setForeground(new Color(0, 204, 204));
|
||||
lPass.setText("Contraseña");
|
||||
lPass2.setFont(new Font("Eras Light ITC", 0, 18)); // NOI18N
|
||||
lPass2.setForeground(new Color(0, 204, 204));
|
||||
lPass2.setText("Verificar Contraseña");
|
||||
GroupLayout registroLayout = new GroupLayout(registro);
|
||||
registro.setLayout(registroLayout);
|
||||
registroLayout.setHorizontalGroup(registroLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(
|
||||
GroupLayout.Alignment.TRAILING,
|
||||
registroLayout.createSequentialGroup().addContainerGap(272, Short.MAX_VALUE).addGroup(registroLayout
|
||||
.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(
|
||||
registroLayout.createSequentialGroup().addGap(33, 33, 33).addGroup(registroLayout
|
||||
.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||
.addGroup(registroLayout.createSequentialGroup().addGap(52, 52, 52)
|
||||
.addComponent(lUser))
|
||||
.addGroup(registroLayout.createSequentialGroup().addGap(34, 34, 34)
|
||||
.addComponent(lPass))
|
||||
.addGroup(registroLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(fUser, GroupLayout.PREFERRED_SIZE, 161,
|
||||
GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(fPass, GroupLayout.PREFERRED_SIZE, 161,
|
||||
GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(registroLayout
|
||||
.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
|
||||
.addGroup(GroupLayout.Alignment.LEADING,
|
||||
registroLayout.createSequentialGroup().addComponent(bRegister)
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,
|
||||
GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(bSalir))
|
||||
.addComponent(fPass2, GroupLayout.Alignment.LEADING,
|
||||
GroupLayout.PREFERRED_SIZE, 161, GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(lPass2)))
|
||||
.addComponent(registrarse)).addGap(266, 266, 266))
|
||||
.addGroup(registroLayout.createSequentialGroup().addGap(323, 323, 323)
|
||||
.addComponent(bienvenido, GroupLayout.PREFERRED_SIZE, 132, GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
|
||||
registroLayout
|
||||
.setVerticalGroup(registroLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||
.addGroup(registroLayout.createSequentialGroup().addContainerGap()
|
||||
.addComponent(registrarse, GroupLayout.PREFERRED_SIZE, 59, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(bienvenido, GroupLayout.PREFERRED_SIZE, 35, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(32, 32, 32).addComponent(lUser)
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(fUser, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(lPass)
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(fPass, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(lPass2)
|
||||
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.addComponent(fPass2, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(18, 18, 18)
|
||||
.addGroup(registroLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(bRegister).addComponent(bSalir))
|
||||
.addContainerGap(76, Short.MAX_VALUE)));
|
||||
panel.add(registro, "card2");
|
||||
GroupLayout layout = new GroupLayout(frame.getContentPane());
|
||||
frame.getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup().addGap(0, 0, 0).addComponent(panel, GroupLayout.DEFAULT_SIZE,
|
||||
GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
|
||||
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||
.addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE)
|
||||
.addComponent(panel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
|
||||
frame.pack();
|
||||
frame.getRootPane().setDefaultButton(bRegister);
|
||||
frame.setVisible(true);
|
||||
frame.setLocationRelativeTo(null);
|
||||
}
|
||||
private void bRegisterActionPerformed(ActionEvent evt)
|
||||
{
|
||||
ControlLogin control = new ControlLogin();
|
||||
if(control.añadirUsuario(fUser.getText(), String.valueOf(fPass.getPassword()), String.valueOf(fPass2.getPassword())))
|
||||
{
|
||||
Login login = new Login();
|
||||
frame.dispose();
|
||||
}
|
||||
}
|
||||
private void bSalirActionPerformed(ActionEvent evt)
|
||||
{
|
||||
Login login = new Login();
|
||||
frame.dispose();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user