añadido modo administrador y solucion de errores
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
[Dolphin]
|
|
||||||
Timestamp=2016,10,31,23,7,53
|
|
||||||
Version=3
|
|
||||||
BIN
bin/control/ControlAdmin.class
Normal file
BIN
bin/control/ControlAdmin.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.
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.
Binary file not shown.
|
Before Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 27 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB |
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.
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.
Binary file not shown.
Binary file not shown.
BIN
bin/visualV2/FrameAdministrador$1.class
Normal file
BIN
bin/visualV2/FrameAdministrador$1.class
Normal file
Binary file not shown.
BIN
bin/visualV2/FrameAdministrador$2.class
Normal file
BIN
bin/visualV2/FrameAdministrador$2.class
Normal file
Binary file not shown.
BIN
bin/visualV2/FrameAdministrador$3.class
Normal file
BIN
bin/visualV2/FrameAdministrador$3.class
Normal file
Binary file not shown.
BIN
bin/visualV2/FrameAdministrador$4.class
Normal file
BIN
bin/visualV2/FrameAdministrador$4.class
Normal file
Binary file not shown.
BIN
bin/visualV2/FrameAdministrador.class
Normal file
BIN
bin/visualV2/FrameAdministrador.class
Normal file
Binary file not shown.
BIN
bin/visualV2/FrameCrear$1.class
Normal file
BIN
bin/visualV2/FrameCrear$1.class
Normal file
Binary file not shown.
BIN
bin/visualV2/FrameCrear.class
Normal file
BIN
bin/visualV2/FrameCrear.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/visualV2/FrameLogin$4.class
Normal file
BIN
bin/visualV2/FrameLogin$4.class
Normal file
Binary file not shown.
Binary file not shown.
BIN
bin/visualV2/FrameModificar$1.class
Normal file
BIN
bin/visualV2/FrameModificar$1.class
Normal file
Binary file not shown.
BIN
bin/visualV2/FrameModificar$2.class
Normal file
BIN
bin/visualV2/FrameModificar$2.class
Normal file
Binary file not shown.
BIN
bin/visualV2/FrameModificar$3.class
Normal file
BIN
bin/visualV2/FrameModificar$3.class
Normal file
Binary file not shown.
BIN
bin/visualV2/FrameModificar.class
Normal file
BIN
bin/visualV2/FrameModificar.class
Normal file
Binary file not shown.
Binary file not shown.
89
src/control/ControlAdmin.java
Normal file
89
src/control/ControlAdmin.java
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
package control;
|
||||||
|
|
||||||
|
import utiles.Archivo;
|
||||||
|
|
||||||
|
public class ControlAdmin {
|
||||||
|
|
||||||
|
Archivo archivo;
|
||||||
|
|
||||||
|
public ControlAdmin() {
|
||||||
|
archivo = new Archivo("UserData");
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRowCount() {
|
||||||
|
|
||||||
|
String[] arch = archivo.entregarProcesado();
|
||||||
|
return arch.length;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getRow(int id) {
|
||||||
|
|
||||||
|
String[] arch = archivo.entregarProcesado();
|
||||||
|
return arch[id].split(";");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean añadirUsuario(String user, String pass) {
|
||||||
|
|
||||||
|
if (!isUser(user)) {
|
||||||
|
if (user.length() > 4) {
|
||||||
|
if (pass.length() > 6) {
|
||||||
|
archivo.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, "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 = archivo.entregarProcesado();
|
||||||
|
for (int x = 0; x < arch.length; x++) {
|
||||||
|
if (arch[x].split(";")[0].equals(user)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean modificarUser(String original, String user, String pass) {
|
||||||
|
|
||||||
|
if (user.length() > 4) {
|
||||||
|
if (pass.length() > 6) {
|
||||||
|
archivo.modificarLinea(original, user + ";" + pass);
|
||||||
|
Archivo.changeName(user, original.split(";")[0]);
|
||||||
|
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, "El usuario es muy corto", null,
|
||||||
|
javax.swing.JOptionPane.ERROR_MESSAGE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ public class ControlLogin {
|
|||||||
|
|
||||||
public ControlLogin() {
|
public ControlLogin() {
|
||||||
|
|
||||||
archivo = new Archivo("dataUser");
|
archivo = new Archivo("UserData");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean añadirUsuario(String user, String pass, String pass2) {
|
public boolean añadirUsuario(String user, String pass, String pass2) {
|
||||||
|
|||||||
@@ -7,11 +7,11 @@ import java.util.GregorianCalendar;
|
|||||||
|
|
||||||
import utiles.Archivo;
|
import utiles.Archivo;
|
||||||
|
|
||||||
public class ControlPrincipal extends Archivo {
|
public class ControlPrincipal{
|
||||||
|
Archivo archivo;
|
||||||
public ControlPrincipal(String usuario) {
|
public ControlPrincipal(String usuario) {
|
||||||
|
|
||||||
super(usuario);
|
archivo = new Archivo(usuario);
|
||||||
ordenar();
|
ordenar();
|
||||||
actId();
|
actId();
|
||||||
actSaldos();
|
actSaldos();
|
||||||
@@ -22,7 +22,7 @@ public class ControlPrincipal extends Archivo {
|
|||||||
int id = 1;
|
int id = 1;
|
||||||
int saldo = 0;
|
int saldo = 0;
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
String[] arch = archivo.entregarProcesado();
|
||||||
String[] lastRow = arch[arch.length - 1].split(";");
|
String[] lastRow = arch[arch.length - 1].split(";");
|
||||||
if(isFiled()){
|
if(isFiled()){
|
||||||
|
|
||||||
@@ -36,14 +36,14 @@ public class ControlPrincipal extends Archivo {
|
|||||||
|
|
||||||
String fila = id + ";" + fecha + ";" + documento + ";" + fd + ";" + desc + ";" + ing + ";" + egr + ";" + saldo;
|
String fila = id + ";" + fecha + ";" + documento + ";" + fd + ";" + desc + ";" + ing + ";" + egr + ";" + saldo;
|
||||||
|
|
||||||
escribirArchivo(fila);
|
archivo.escribirArchivo(fila);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void modificarFila(String id, String fecha, String documento, String fd, String desc, String ing,
|
public void modificarFila(String id, String fecha, String documento, String fd, String desc, String ing,
|
||||||
String egr) {
|
String egr) {
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
String[] arch = archivo.entregarProcesado();
|
||||||
|
|
||||||
for (int x = 0; x < arch.length; x++) {
|
for (int x = 0; x < arch.length; x++) {
|
||||||
|
|
||||||
@@ -57,19 +57,19 @@ public class ControlPrincipal extends Archivo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
actSaldos();
|
actSaldos();
|
||||||
actArchivo(arch);
|
archivo.actArchivo(arch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void eliminarFila(String id) {
|
public void eliminarFila(String id) {
|
||||||
|
|
||||||
borrarLinea(id);
|
archivo.borrarLinea(id);
|
||||||
actSaldos();
|
actSaldos();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ordenar() {
|
public void ordenar() {
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
String[] arch = archivo.entregarProcesado();
|
||||||
|
|
||||||
boolean swapped = true;
|
boolean swapped = true;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
@@ -101,12 +101,12 @@ public class ControlPrincipal extends Archivo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
actArchivo(arch);
|
archivo.actArchivo(arch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void actSaldos() {
|
public void actSaldos() {
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
String[] arch = archivo.entregarProcesado();
|
||||||
if(isFiled()){
|
if(isFiled()){
|
||||||
|
|
||||||
for (int x = 0; x < arch.length; x++) {
|
for (int x = 0; x < arch.length; x++) {
|
||||||
@@ -141,7 +141,7 @@ public class ControlPrincipal extends Archivo {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
actArchivo(arch);
|
archivo.actArchivo(arch);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +149,7 @@ public class ControlPrincipal extends Archivo {
|
|||||||
|
|
||||||
public void actId() {
|
public void actId() {
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
String[] arch = archivo.entregarProcesado();
|
||||||
int id = 1;
|
int id = 1;
|
||||||
for (int x = 0; x < arch.length; x++) {
|
for (int x = 0; x < arch.length; x++) {
|
||||||
|
|
||||||
@@ -167,33 +167,33 @@ public class ControlPrincipal extends Archivo {
|
|||||||
arch[x] = linea;
|
arch[x] = linea;
|
||||||
|
|
||||||
}
|
}
|
||||||
actArchivo(arch);
|
archivo.actArchivo(arch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getLastRow() {
|
public String[] getLastRow() {
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
String[] arch = archivo.entregarProcesado();
|
||||||
return arch[arch.length - 1].split(";");
|
return arch[arch.length - 1].split(";");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getRow(int id) {
|
public String[] getRow(int id) {
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
String[] arch = archivo.entregarProcesado();
|
||||||
return arch[id].split(";");
|
return arch[id].split(";");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRowCount() {
|
public int getRowCount() {
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
String[] arch = archivo.entregarProcesado();
|
||||||
return arch.length;
|
return arch.length;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isFiled() {
|
public boolean isFiled() {
|
||||||
|
|
||||||
return (leerArchivo().length() > 5);
|
return (archivo.leerArchivo().length() > 5);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,9 +201,9 @@ public class ControlPrincipal extends Archivo {
|
|||||||
|
|
||||||
String[][] fin = new String[4][1];
|
String[][] fin = new String[4][1];
|
||||||
|
|
||||||
if (leerArchivo().length() > 5) {
|
if (archivo.leerArchivo().length() > 5) {
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
String[] arch = archivo.entregarProcesado();
|
||||||
ArrayList<String> fechas = new ArrayList<String>();
|
ArrayList<String> fechas = new ArrayList<String>();
|
||||||
ArrayList<String> ings = new ArrayList<String>();
|
ArrayList<String> ings = new ArrayList<String>();
|
||||||
ArrayList<String> egrs = new ArrayList<String>();
|
ArrayList<String> egrs = new ArrayList<String>();
|
||||||
@@ -303,10 +303,10 @@ public class ControlPrincipal extends Archivo {
|
|||||||
|
|
||||||
public int[] resumenDoc() {
|
public int[] resumenDoc() {
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
String[] arch = archivo.entregarProcesado();
|
||||||
int[] docs = { 0, 0, 0 };
|
int[] docs = { 0, 0, 0 };
|
||||||
|
|
||||||
if (leerArchivo().length() > 5) {
|
if (archivo.leerArchivo().length() > 5) {
|
||||||
|
|
||||||
for (int x = 0; x < arch.length; x++) {
|
for (int x = 0; x < arch.length; x++) {
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ public class Archivo {
|
|||||||
|
|
||||||
public Archivo(String archivo) {
|
public Archivo(String archivo) {
|
||||||
|
|
||||||
|
|
||||||
String ruta = getRuta(archivo);
|
String ruta = getRuta(archivo);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -27,8 +26,17 @@ public class Archivo {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void changeName(String nuevo, String old){
|
||||||
|
|
||||||
|
File oldArch = new File(getRuta(old));
|
||||||
|
File newArch = new File(getRuta(nuevo));
|
||||||
|
|
||||||
|
oldArch.renameTo(newArch);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public String getRuta(String archivo) {
|
public static String getRuta(String archivo) {
|
||||||
|
|
||||||
String ruta = "";
|
String ruta = "";
|
||||||
String os = System.getProperty("os.name");
|
String os = System.getProperty("os.name");
|
||||||
@@ -139,6 +147,21 @@ public class Archivo {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void modificarLinea(String linea, String nueva){
|
||||||
|
|
||||||
|
abrirEscribir();
|
||||||
|
String[] arch = entregarProcesado();
|
||||||
|
for(int x = 0; x < arch.length; x++){
|
||||||
|
if(arch[x].equals(linea)){
|
||||||
|
arch[x] = nueva;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
actArchivo(arch);
|
||||||
|
cerrarEscribir();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private void abrirLeer() {
|
private void abrirLeer() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,340 +0,0 @@
|
|||||||
package utiles;
|
|
||||||
|
|
||||||
import java.time.YearMonth;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.GregorianCalendar;
|
|
||||||
|
|
||||||
public class ControlPrincipal extends Archivo {
|
|
||||||
|
|
||||||
public ControlPrincipal(String usuario) {
|
|
||||||
|
|
||||||
super(usuario);
|
|
||||||
ordenar();
|
|
||||||
actId();
|
|
||||||
actSaldos();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void añadir(String fecha, String documento, String fd, String desc, String ing, String egr) {
|
|
||||||
|
|
||||||
int id = 1;
|
|
||||||
int saldo = 0;
|
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
|
||||||
String[] lastRow = arch[arch.length - 1].split(";");
|
|
||||||
if(isFiled()){
|
|
||||||
|
|
||||||
id = Integer.parseInt(lastRow[0]) + 1;
|
|
||||||
saldo = Integer.parseInt(lastRow[lastRow.length - 1]) + Integer.parseInt(ing) - Integer.parseInt(egr);
|
|
||||||
}else{
|
|
||||||
|
|
||||||
saldo = Integer.parseInt(ing) - Integer.parseInt(egr);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
String fila = id + ";" + fecha + ";" + documento + ";" + fd + ";" + desc + ";" + ing + ";" + egr + ";" + saldo;
|
|
||||||
|
|
||||||
escribirArchivo(fila);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void modificarFila(String id, String fecha, String documento, String fd, String desc, String ing,
|
|
||||||
String egr) {
|
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
|
||||||
|
|
||||||
for (int x = 0; x < arch.length; x++) {
|
|
||||||
|
|
||||||
if (arch[x].split(";")[0].equals(id)) {
|
|
||||||
|
|
||||||
arch[x] = id + ";" + fecha + ";" + documento + ";" + fd + ";" + desc + ";" + ing + ";" + egr + ";"
|
|
||||||
+ "0";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
actSaldos();
|
|
||||||
actArchivo(arch);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void eliminarFila(String id) {
|
|
||||||
|
|
||||||
borrarLinea(id);
|
|
||||||
actSaldos();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ordenar() {
|
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
|
||||||
|
|
||||||
boolean swapped = true;
|
|
||||||
int j = 0;
|
|
||||||
String tmp;
|
|
||||||
|
|
||||||
while (swapped) {
|
|
||||||
|
|
||||||
swapped = false;
|
|
||||||
j++;
|
|
||||||
|
|
||||||
for (int i = 0; i < arch.length - j; i++) {
|
|
||||||
|
|
||||||
Calendar f1 = new GregorianCalendar(Integer.parseInt(arch[i].split(";")[1].split("/")[2]),
|
|
||||||
Integer.parseInt(arch[i].split(";")[1].split("/")[1]),
|
|
||||||
Integer.parseInt(arch[i].split(";")[1].split("/")[0]));
|
|
||||||
Calendar f2 = new GregorianCalendar(Integer.parseInt(arch[i + 1].split(";")[1].split("/")[2]),
|
|
||||||
Integer.parseInt(arch[i + 1].split(";")[1].split("/")[1]),
|
|
||||||
Integer.parseInt(arch[i + 1].split(";")[1].split("/")[0]));
|
|
||||||
|
|
||||||
if (f1.after(f2)) {
|
|
||||||
|
|
||||||
tmp = arch[i];
|
|
||||||
arch[i] = arch[i + 1];
|
|
||||||
arch[i + 1] = tmp;
|
|
||||||
swapped = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
actArchivo(arch);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void actSaldos() {
|
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
|
||||||
if(isFiled()){
|
|
||||||
|
|
||||||
for (int x = 0; x < arch.length; x++) {
|
|
||||||
|
|
||||||
int saldoAnterior = 0;
|
|
||||||
int saldo = 0;
|
|
||||||
|
|
||||||
if (x > 0) {
|
|
||||||
|
|
||||||
String[] aux = arch[x - 1].split(";");
|
|
||||||
saldoAnterior = Integer.parseInt(aux[aux.length - 1]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
String textAux = "";
|
|
||||||
String[] aux = arch[x].split(";");
|
|
||||||
|
|
||||||
if (arch[x].length() > 1) {
|
|
||||||
|
|
||||||
saldo = saldoAnterior + Integer.parseInt(aux[5]) - Integer.parseInt(aux[6]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int z = 0; z < aux.length - 1; z++) {
|
|
||||||
|
|
||||||
textAux += aux[z] + ";";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
textAux += saldo;
|
|
||||||
arch[x] = textAux;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
actArchivo(arch);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void actId() {
|
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
|
||||||
int id = 1;
|
|
||||||
for (int x = 0; x < arch.length; x++) {
|
|
||||||
|
|
||||||
String[] aux = arch[x].split(";");
|
|
||||||
aux[0] = String.valueOf(id);
|
|
||||||
id++;
|
|
||||||
|
|
||||||
String linea = "";
|
|
||||||
for (int z = 0; z < aux.length; z++) {
|
|
||||||
|
|
||||||
linea += aux[z] + ";";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
arch[x] = linea;
|
|
||||||
|
|
||||||
}
|
|
||||||
actArchivo(arch);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] getLastRow() {
|
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
|
||||||
return arch[arch.length - 1].split(";");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] getRow(int id) {
|
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
|
||||||
return arch[id].split(";");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRowCount() {
|
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
|
||||||
return arch.length;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFiled() {
|
|
||||||
|
|
||||||
return (leerArchivo().length() > 5);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[][] resumenMes() {
|
|
||||||
|
|
||||||
String[][] fin = new String[4][1];
|
|
||||||
|
|
||||||
if (leerArchivo().length() > 5) {
|
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
|
||||||
ArrayList<String> fechas = new ArrayList<String>();
|
|
||||||
ArrayList<String> ings = new ArrayList<String>();
|
|
||||||
ArrayList<String> egrs = new ArrayList<String>();
|
|
||||||
|
|
||||||
for (int x = 0; x < arch.length; x++) {
|
|
||||||
|
|
||||||
String fecha = arch[x].split(";")[1].split("/")[2] + "-" + arch[x].split(";")[1].split("/")[1];
|
|
||||||
|
|
||||||
if (!fechas.contains(fecha)) {
|
|
||||||
|
|
||||||
fechas.add(fecha);
|
|
||||||
ings.add("0");
|
|
||||||
egrs.add("0");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int x = 0; x < arch.length; x++) {
|
|
||||||
|
|
||||||
String fecha = arch[x].split(";")[1].split("/")[2] + "-" + arch[x].split(";")[1].split("/")[1];
|
|
||||||
String ing = arch[x].split(";")[5];
|
|
||||||
String egr = arch[x].split(";")[6];
|
|
||||||
int index = fechas.indexOf(fecha);
|
|
||||||
|
|
||||||
ings.set(index, String.valueOf(Integer.parseInt(ings.get(index)) + Integer.parseInt(ing)));
|
|
||||||
egrs.set(index, String.valueOf(Integer.parseInt(egrs.get(index)) + Integer.parseInt(egr)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fin = new String[4][fechas.size()];
|
|
||||||
|
|
||||||
for (int x = 0; x < fechas.size(); x++) {
|
|
||||||
|
|
||||||
fin[0][x] = fechas.get(x);
|
|
||||||
fin[1][x] = String.valueOf(Integer.parseInt(ings.get(x)) - Integer.parseInt(egrs.get(x)));
|
|
||||||
fin[2][x] = ings.get(x);
|
|
||||||
fin[3][x] = egrs.get(x);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fin = ordenarSaldos(fin);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return fin;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[][] ordenarSaldos(String[][] saldos) {
|
|
||||||
|
|
||||||
boolean swapped = true;
|
|
||||||
int j = 0;
|
|
||||||
String tmp;
|
|
||||||
String tmp1;
|
|
||||||
String tmp2;
|
|
||||||
String tmp3;
|
|
||||||
|
|
||||||
while (swapped) {
|
|
||||||
|
|
||||||
swapped = false;
|
|
||||||
j++;
|
|
||||||
|
|
||||||
for (int i = 0; i < saldos[0].length - j; i++) {
|
|
||||||
|
|
||||||
YearMonth f1 = YearMonth.parse(saldos[0][i]);
|
|
||||||
YearMonth f2 = YearMonth.parse(saldos[0][i + 1]);
|
|
||||||
|
|
||||||
if (f1.isAfter(f2)) {
|
|
||||||
|
|
||||||
tmp = saldos[0][i];
|
|
||||||
tmp1 = saldos[1][i];
|
|
||||||
tmp2 = saldos[2][i];
|
|
||||||
tmp3 = saldos[3][i];
|
|
||||||
|
|
||||||
saldos[0][i] = saldos[0][i + 1];
|
|
||||||
saldos[1][i] = saldos[1][i + 1];
|
|
||||||
saldos[2][i] = saldos[2][i + 1];
|
|
||||||
saldos[3][i] = saldos[3][i + 1];
|
|
||||||
|
|
||||||
saldos[0][i + 1] = tmp;
|
|
||||||
saldos[1][i + 1] = tmp1;
|
|
||||||
saldos[2][i + 1] = tmp2;
|
|
||||||
saldos[3][i + 1] = tmp3;
|
|
||||||
|
|
||||||
swapped = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return saldos;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[] resumenDoc() {
|
|
||||||
|
|
||||||
String[] arch = entregarProcesado();
|
|
||||||
int[] docs = { 0, 0, 0 };
|
|
||||||
|
|
||||||
if (leerArchivo().length() > 5) {
|
|
||||||
|
|
||||||
for (int x = 0; x < arch.length; x++) {
|
|
||||||
|
|
||||||
String[] aux = arch[x].split(";");
|
|
||||||
|
|
||||||
switch (aux[2]) {
|
|
||||||
|
|
||||||
case "Efectivo":
|
|
||||||
|
|
||||||
docs[0] += Integer.parseInt(aux[5]) - Integer.parseInt(aux[6]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "Transferencia":
|
|
||||||
|
|
||||||
docs[1] += Integer.parseInt(aux[5]) - Integer.parseInt(aux[6]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "Credito":
|
|
||||||
|
|
||||||
docs[2] += Integer.parseInt(aux[5]) - Integer.parseInt(aux[6]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return docs;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,169 +0,0 @@
|
|||||||
package visual;
|
|
||||||
|
|
||||||
import java.awt.event.*;
|
|
||||||
import javax.swing.*;
|
|
||||||
import utiles.ControlLogin;
|
|
||||||
|
|
||||||
public class FrameLogin extends JFrame {
|
|
||||||
|
|
||||||
private JButton bIngresar;
|
|
||||||
private JButton bRegistrar;
|
|
||||||
private JButton bSalir;
|
|
||||||
private JPanel bar;
|
|
||||||
private JLabel bienvenido;
|
|
||||||
private JPasswordField fContraseña1;
|
|
||||||
private JTextField fUsuario;
|
|
||||||
private JLabel lContraseña;
|
|
||||||
private JLabel lUsuario;
|
|
||||||
private JLabel pam;
|
|
||||||
|
|
||||||
public FrameLogin() {
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initComponents() {
|
|
||||||
|
|
||||||
bienvenido = new JLabel();
|
|
||||||
bIngresar = new JButton();
|
|
||||||
bSalir = new JButton();
|
|
||||||
fUsuario = new JTextField();
|
|
||||||
lUsuario = new JLabel();
|
|
||||||
lContraseña = new JLabel();
|
|
||||||
fContraseña1 = new JPasswordField();
|
|
||||||
bar = new JPanel();
|
|
||||||
pam = new JLabel();
|
|
||||||
bRegistrar = new JButton();
|
|
||||||
|
|
||||||
setResizable(false);
|
|
||||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
|
||||||
getContentPane().setBackground(new java.awt.Color(21, 21, 21));
|
|
||||||
|
|
||||||
bienvenido.setFont(new java.awt.Font("Eras Light ITC", 0, 18)); // NOI18N
|
|
||||||
bienvenido.setForeground(new java.awt.Color(255, 255, 255));
|
|
||||||
bienvenido.setText(" Bienvenido de nuevo ");
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lUsuario.setFont(new java.awt.Font("Eras Light ITC", 0, 18)); // NOI18N
|
|
||||||
lUsuario.setForeground(new java.awt.Color(0, 204, 204));
|
|
||||||
lUsuario.setText(" Usuario");
|
|
||||||
|
|
||||||
lContraseña.setFont(new java.awt.Font("Eras Light ITC", 0, 18)); // NOI18N
|
|
||||||
lContraseña.setForeground(new java.awt.Color(0, 204, 204));
|
|
||||||
lContraseña.setText(" Contraseña");
|
|
||||||
|
|
||||||
bar.setBackground(new java.awt.Color(0, 204, 204));
|
|
||||||
bar.setPreferredSize(new java.awt.Dimension(215, 2));
|
|
||||||
|
|
||||||
GroupLayout barLayout = new GroupLayout(bar);
|
|
||||||
bar.setLayout(barLayout);
|
|
||||||
barLayout.setHorizontalGroup(
|
|
||||||
barLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0, 251, Short.MAX_VALUE));
|
|
||||||
barLayout.setVerticalGroup(
|
|
||||||
barLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0, 9, Short.MAX_VALUE));
|
|
||||||
|
|
||||||
pam.setFont(new java.awt.Font("Eras Light ITC", 2, 60)); // NOI18N
|
|
||||||
pam.setForeground(new java.awt.Color(0, 204, 204));
|
|
||||||
pam.setText(" P.A.M");
|
|
||||||
|
|
||||||
bRegistrar.setText("Registrarse");
|
|
||||||
bRegistrar.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent evt) {
|
|
||||||
bRegistrarActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
|
||||||
getContentPane().setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout
|
|
||||||
.createSequentialGroup().addGap(147, 147, 147)
|
|
||||||
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(bar, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 251,
|
|
||||||
GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(bienvenido, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 251,
|
|
||||||
GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(pam, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 251,
|
|
||||||
GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup().addGroup(layout
|
|
||||||
.createParallelGroup(GroupLayout.Alignment.TRAILING)
|
|
||||||
.addGroup(layout.createSequentialGroup().addComponent(bRegistrar).addGap(30, 30, 30))
|
|
||||||
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
|
|
||||||
.addComponent(fUsuario, GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(fContraseña1, GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(lContraseña, GroupLayout.Alignment.LEADING,
|
|
||||||
GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(lUsuario, GroupLayout.Alignment.LEADING,
|
|
||||||
GroupLayout.PREFERRED_SIZE, 161, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(bIngresar, GroupLayout.PREFERRED_SIZE, 90,
|
|
||||||
GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(bSalir, GroupLayout.PREFERRED_SIZE, 65,
|
|
||||||
GroupLayout.PREFERRED_SIZE))))
|
|
||||||
.addGap(47, 47, 47)))
|
|
||||||
.addContainerGap(150, Short.MAX_VALUE)));
|
|
||||||
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(layout.createSequentialGroup().addContainerGap(16, Short.MAX_VALUE).addComponent(pam)
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
|
|
||||||
.addComponent(bienvenido, GroupLayout.PREFERRED_SIZE, 35, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
|
|
||||||
.addComponent(bar, GroupLayout.PREFERRED_SIZE, 9, GroupLayout.PREFERRED_SIZE).addGap(18, 18, 18)
|
|
||||||
.addComponent(lUsuario).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(fUsuario, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(lContraseña)
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(fContraseña1, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,20,20)
|
|
||||||
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(bIngresar)
|
|
||||||
.addComponent(bSalir))
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(bRegistrar)
|
|
||||||
.addGap(69, 69, 69)));
|
|
||||||
|
|
||||||
setTitle("Login - P.A.M");
|
|
||||||
setUndecorated(true);
|
|
||||||
pack();
|
|
||||||
getRootPane().setDefaultButton(bIngresar);
|
|
||||||
setVisible(true);
|
|
||||||
setLocationRelativeTo(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void bIngresarActionPerformed(ActionEvent evt) {
|
|
||||||
ControlLogin control = new ControlLogin();
|
|
||||||
if (control.isUserPass(fUsuario.getText(), String.valueOf(fContraseña1.getPassword()))) {
|
|
||||||
|
|
||||||
FramePrincipal principal = new FramePrincipal(fUsuario.getText());
|
|
||||||
dispose();
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
JOptionPane.showMessageDialog(null, "Usuario o contraseña incorrectas", null, JOptionPane.ERROR_MESSAGE);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void bSalirActionPerformed(ActionEvent evt) {
|
|
||||||
|
|
||||||
System.exit(0);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void bRegistrarActionPerformed(ActionEvent evt) {
|
|
||||||
FrameRegistro registro = new FrameRegistro();
|
|
||||||
dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
package visual;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import javax.swing.*;
|
|
||||||
|
|
||||||
public class FramePrincipal extends JFrame{
|
|
||||||
|
|
||||||
private JPanel panel;
|
|
||||||
|
|
||||||
private PanelPrincipal panelPrincipal;
|
|
||||||
private PanelCartola panelCartola;
|
|
||||||
private PanelResumen panelResumen;
|
|
||||||
|
|
||||||
private String usuario;
|
|
||||||
|
|
||||||
public FramePrincipal(String usuario) {
|
|
||||||
|
|
||||||
this.usuario = usuario;
|
|
||||||
initComponents();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initComponents() {
|
|
||||||
panel = new JPanel();
|
|
||||||
panelResumen = new PanelResumen(usuario);
|
|
||||||
panelPrincipal = new PanelPrincipal(usuario);
|
|
||||||
panelCartola = new PanelCartola(usuario);
|
|
||||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
|
||||||
panel.setBackground(new Color(204, 204, 204));
|
|
||||||
panel.setRequestFocusEnabled(false);
|
|
||||||
panel.setLayout(new CardLayout());
|
|
||||||
panel.add(panelCartola, "card2");
|
|
||||||
panel.add(panelResumen, "card3");
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
|
||||||
getContentPane().setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(layout.createSequentialGroup().addGap(0, 0, 0)
|
|
||||||
.addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(panelPrincipal, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
|
|
||||||
Short.MAX_VALUE)
|
|
||||||
.addComponent(panel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
|
|
||||||
Short.MAX_VALUE))));
|
|
||||||
layout.setVerticalGroup(
|
|
||||||
layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING,
|
|
||||||
layout.createSequentialGroup()
|
|
||||||
.addComponent(panelPrincipal, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
|
|
||||||
GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(0, 0, 0).addComponent(panel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
|
|
||||||
Short.MAX_VALUE)));
|
|
||||||
|
|
||||||
setTitle("P.A.M - (Personal Account Managger)");
|
|
||||||
pack();
|
|
||||||
setLocationRelativeTo(null);
|
|
||||||
setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void openResumen(){
|
|
||||||
CardLayout cardLayout = (CardLayout) panel.getLayout();
|
|
||||||
cardLayout.show(panel, "card3");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void openCartola(){
|
|
||||||
CardLayout cardLayout = (CardLayout) panel.getLayout();
|
|
||||||
cardLayout.show(panel, "card2");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void actResumen(){
|
|
||||||
panelResumen.actualizarGraphDoc();
|
|
||||||
panelResumen.actualizarGraphMes();
|
|
||||||
panelResumen.llenarResumen();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,155 +0,0 @@
|
|||||||
package visual;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.*;
|
|
||||||
import javax.swing.*;
|
|
||||||
|
|
||||||
import utiles.ControlLogin;
|
|
||||||
|
|
||||||
public class FrameRegistro extends JFrame{
|
|
||||||
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 FrameRegistro() {
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initComponents() {
|
|
||||||
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();
|
|
||||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
|
||||||
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(getContentPane());
|
|
||||||
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)));
|
|
||||||
|
|
||||||
setUndecorated(true);
|
|
||||||
pack();
|
|
||||||
getRootPane().setDefaultButton(bRegister);
|
|
||||||
setVisible(true);
|
|
||||||
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()))) {
|
|
||||||
FrameLogin login = new FrameLogin();
|
|
||||||
dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void bSalirActionPerformed(ActionEvent evt) {
|
|
||||||
FrameLogin login = new FrameLogin();
|
|
||||||
dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
package visual;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
|
|
||||||
import javax.swing.JTable;
|
|
||||||
import javax.swing.ListSelectionModel;
|
|
||||||
import javax.swing.table.DefaultTableModel;
|
|
||||||
|
|
||||||
import utiles.ControlPrincipal;
|
|
||||||
|
|
||||||
public class JTableTable extends JTable{
|
|
||||||
|
|
||||||
String usuario;
|
|
||||||
public JTableTable(String usuario){
|
|
||||||
|
|
||||||
this.usuario = usuario;
|
|
||||||
iniciar();
|
|
||||||
|
|
||||||
}
|
|
||||||
public void iniciar(){
|
|
||||||
setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
|
||||||
setBackground(new Color(0, 204, 204));
|
|
||||||
setModel(new DefaultTableModel(new Object[][] {}, new String[] { "N°", "Fecha", "Documento",
|
|
||||||
"Fuente/Destino", "Descripcion", "Ingreso", "Egreso", "Saldo" }) {
|
|
||||||
boolean[] canEdit = new boolean[] { false, false, false, false, false, false, false, false };
|
|
||||||
|
|
||||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
|
||||||
return canEdit[columnIndex];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
setGridColor(new Color(255, 255, 255));
|
|
||||||
setSelectionForeground(new Color(0, 120, 215));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void actTabla() {
|
|
||||||
|
|
||||||
ControlPrincipal control = new ControlPrincipal(usuario);
|
|
||||||
DefaultTableModel modelo = (DefaultTableModel) getModel();
|
|
||||||
|
|
||||||
setModel(modelo);
|
|
||||||
modelo.setRowCount(0);
|
|
||||||
|
|
||||||
if (control.isFiled()) {
|
|
||||||
|
|
||||||
for (int x = 0; x < control.getRowCount(); x++) {
|
|
||||||
|
|
||||||
Object[] fila = control.getRow(x);
|
|
||||||
modelo.addRow(fila);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,185 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 27 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.2 KiB |
@@ -1,459 +0,0 @@
|
|||||||
package visual;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Font;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.awt.event.KeyAdapter;
|
|
||||||
import java.awt.event.KeyEvent;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
import javax.swing.DefaultComboBoxModel;
|
|
||||||
import javax.swing.GroupLayout;
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JComboBox;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import javax.swing.JScrollPane;
|
|
||||||
import javax.swing.JTextField;
|
|
||||||
import javax.swing.LayoutStyle;
|
|
||||||
|
|
||||||
import org.jdesktop.swingx.JXDatePicker;
|
|
||||||
|
|
||||||
import utiles.ControlPrincipal;
|
|
||||||
import utiles.Validador;
|
|
||||||
|
|
||||||
public class PanelCartola extends JPanel {
|
|
||||||
|
|
||||||
private JButton añadir;
|
|
||||||
private JButton eliminar;
|
|
||||||
private JButton modificar;
|
|
||||||
|
|
||||||
private JScrollPane jScrollPane1;
|
|
||||||
private JTableTable tabla;
|
|
||||||
|
|
||||||
private String usuario;
|
|
||||||
|
|
||||||
private JLabel lFD;
|
|
||||||
private JLabel lFD1;
|
|
||||||
private JLabel lEgr;
|
|
||||||
private JLabel lEgr1;
|
|
||||||
private JLabel lIng;
|
|
||||||
private JLabel lIng1;
|
|
||||||
private JLabel lDesc;
|
|
||||||
private JLabel lDesc1;
|
|
||||||
private JLabel lDocumento;
|
|
||||||
private JLabel lDocumento1;
|
|
||||||
private JLabel lFecha2;
|
|
||||||
private JLabel lFecha3;
|
|
||||||
private JLabel lFecha4;
|
|
||||||
|
|
||||||
private JComboBox<String> documento;
|
|
||||||
private JComboBox<String> documento1;
|
|
||||||
|
|
||||||
private JTextField fFD;
|
|
||||||
private JTextField fFD1;
|
|
||||||
private JTextField fDesc;
|
|
||||||
private JTextField fDesc1;
|
|
||||||
private JTextField fIng;
|
|
||||||
private JTextField fIng1;
|
|
||||||
private JTextField fEgr;
|
|
||||||
private JTextField fEgr1;
|
|
||||||
private JTextField fNumber;
|
|
||||||
|
|
||||||
private JXDatePicker jXDatePicker1;
|
|
||||||
private JXDatePicker jXDatePicker2;
|
|
||||||
|
|
||||||
public PanelCartola(String usuario) {
|
|
||||||
|
|
||||||
this.usuario = usuario;
|
|
||||||
init();
|
|
||||||
tabla.actTabla();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void init() {
|
|
||||||
|
|
||||||
tabla = new JTableTable(usuario);
|
|
||||||
jScrollPane1 = new JScrollPane();
|
|
||||||
jScrollPane1.getViewport().setBackground(new Color(128, 203, 196));
|
|
||||||
jScrollPane1.setViewportView(tabla);
|
|
||||||
|
|
||||||
if (tabla.getColumnModel().getColumnCount() > 0) {
|
|
||||||
|
|
||||||
tabla.getColumnModel().getColumn(0).setResizable(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
lFD = new JLabel();
|
|
||||||
lFD.setBackground(new Color(0, 204, 204));
|
|
||||||
lFD.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lFD.setForeground(new Color(0, 204, 204));
|
|
||||||
lFD.setText("Fuente/Destino:");
|
|
||||||
|
|
||||||
lFD1 = new JLabel();
|
|
||||||
lFD1.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lFD1.setForeground(new Color(0, 204, 204));
|
|
||||||
lFD1.setText("Fuente/Destino:");
|
|
||||||
|
|
||||||
lEgr = new JLabel();
|
|
||||||
lEgr.setBackground(new Color(0, 204, 204));
|
|
||||||
lEgr.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lEgr.setForeground(new Color(0, 204, 204));
|
|
||||||
lEgr.setText("Egreso:");
|
|
||||||
|
|
||||||
lEgr1 = new JLabel();
|
|
||||||
lEgr1.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lEgr1.setForeground(new Color(0, 204, 204));
|
|
||||||
lEgr1.setText("Egreso:");
|
|
||||||
|
|
||||||
lIng = new JLabel();
|
|
||||||
lIng.setBackground(new Color(0, 204, 204));
|
|
||||||
lIng.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lIng.setForeground(new Color(0, 204, 204));
|
|
||||||
lIng.setText("Ingreso:");
|
|
||||||
|
|
||||||
lIng1 = new JLabel();
|
|
||||||
lIng1.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lIng1.setForeground(new Color(0, 204, 204));
|
|
||||||
lIng1.setText("Ingreso:");
|
|
||||||
|
|
||||||
lDesc = new JLabel();
|
|
||||||
lDesc.setBackground(new Color(0, 204, 204));
|
|
||||||
lDesc.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lDesc.setForeground(new Color(0, 204, 204));
|
|
||||||
lDesc.setText("Descripcion:");
|
|
||||||
|
|
||||||
lDesc1 = new JLabel();
|
|
||||||
lDesc1.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lDesc1.setForeground(new Color(0, 204, 204));
|
|
||||||
lDesc1.setText("Descripcion:");
|
|
||||||
|
|
||||||
lDocumento = new JLabel();
|
|
||||||
lDocumento.setBackground(new Color(0, 204, 204));
|
|
||||||
lDocumento.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lDocumento.setForeground(new Color(0, 204, 204));
|
|
||||||
lDocumento.setText("Documento:");
|
|
||||||
|
|
||||||
lDocumento1 = new JLabel();
|
|
||||||
lDocumento1.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lDocumento1.setForeground(new Color(0, 204, 204));
|
|
||||||
lDocumento1.setText("Documento:");
|
|
||||||
|
|
||||||
lFecha2 = new JLabel();
|
|
||||||
lFecha2.setBackground(new Color(0, 204, 204));
|
|
||||||
lFecha2.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lFecha2.setForeground(new Color(0, 204, 204));
|
|
||||||
lFecha2.setText("Fecha:");
|
|
||||||
|
|
||||||
lFecha3 = new JLabel();
|
|
||||||
lFecha3.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lFecha3.setForeground(new Color(0, 204, 204));
|
|
||||||
lFecha3.setText("Fecha:");
|
|
||||||
|
|
||||||
lFecha4 = new JLabel();
|
|
||||||
lFecha4.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lFecha4.setForeground(new Color(0, 204, 204));
|
|
||||||
lFecha4.setText("N°:");
|
|
||||||
|
|
||||||
documento = new JComboBox<>();
|
|
||||||
documento.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
documento.setModel(new DefaultComboBoxModel<>(new String[] { "Efectivo", "Credito", "Transferencia" }));
|
|
||||||
|
|
||||||
documento1 = new JComboBox<>();
|
|
||||||
documento1.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
documento1.setModel(new DefaultComboBoxModel<>(new String[] { "Efectivo", "Credito", "Transferencia" }));
|
|
||||||
|
|
||||||
fFD = new JTextField();
|
|
||||||
fFD1 = new JTextField();
|
|
||||||
|
|
||||||
fDesc = new JTextField();
|
|
||||||
fDesc1 = new JTextField();
|
|
||||||
|
|
||||||
fIng = new JTextField();
|
|
||||||
fIng.addKeyListener(new KeyAdapter() {
|
|
||||||
|
|
||||||
public void keyTyped(KeyEvent e) {
|
|
||||||
|
|
||||||
char c = e.getKeyChar();
|
|
||||||
|
|
||||||
if (!Character.isDigit(c)) {
|
|
||||||
e.consume();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
fIng.setText("0");
|
|
||||||
fIng1 = new JTextField();
|
|
||||||
fIng1.addKeyListener(new KeyAdapter() {
|
|
||||||
|
|
||||||
public void keyTyped(KeyEvent e) {
|
|
||||||
|
|
||||||
char c = e.getKeyChar();
|
|
||||||
|
|
||||||
if (!Character.isDigit(c)) {
|
|
||||||
e.consume();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
fIng1.setText("0");
|
|
||||||
|
|
||||||
fEgr = new JTextField();
|
|
||||||
fEgr.setText("0");
|
|
||||||
fEgr1 = new JTextField();
|
|
||||||
fEgr1.setText("0");
|
|
||||||
|
|
||||||
fNumber = new JTextField();
|
|
||||||
|
|
||||||
Calendar today = Calendar.getInstance();
|
|
||||||
|
|
||||||
jXDatePicker1 = new JXDatePicker();
|
|
||||||
jXDatePicker1.setDate(today.getTime());
|
|
||||||
jXDatePicker2 = new JXDatePicker();
|
|
||||||
jXDatePicker2.setDate(today.getTime());
|
|
||||||
|
|
||||||
eliminar = new JButton();
|
|
||||||
eliminar.setText("Eliminar Fila Seleccionada");
|
|
||||||
eliminar.addActionListener(new ActionListener() {
|
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent evt) {
|
|
||||||
|
|
||||||
eliminarActionPerformed(evt);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
añadir = new JButton();
|
|
||||||
añadir.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
añadir.setText("añadir");
|
|
||||||
añadir.addActionListener(new ActionListener() {
|
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent evt) {
|
|
||||||
|
|
||||||
añadirActionPerformed(evt);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
modificar = new JButton();
|
|
||||||
modificar.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
modificar.setText("Modificar");
|
|
||||||
modificar.addActionListener(new ActionListener() {
|
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent evt) {
|
|
||||||
|
|
||||||
modificarActionPerformed(evt);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
setBackground(new Color(21, 21, 21));
|
|
||||||
GroupLayout panelCartolaLayout = new GroupLayout(this);
|
|
||||||
setLayout(panelCartolaLayout);
|
|
||||||
panelCartolaLayout.setHorizontalGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(panelCartolaLayout.createSequentialGroup()
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(
|
|
||||||
panelCartolaLayout.createSequentialGroup().addGap(747, 747, 747).addComponent(eliminar))
|
|
||||||
.addGroup(panelCartolaLayout.createSequentialGroup().addContainerGap()
|
|
||||||
.addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 933, Short.MAX_VALUE)))
|
|
||||||
.addGap(30, 30,
|
|
||||||
30)
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
|
|
||||||
.addGroup(panelCartolaLayout.createSequentialGroup()
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(lFD).addComponent(lEgr, GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(lIng, GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(lDesc, GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(lDocumento, GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(lFecha2, GroupLayout.Alignment.TRAILING))
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelCartolaLayout
|
|
||||||
.createParallelGroup(GroupLayout.Alignment.LEADING, false)
|
|
||||||
.addComponent(documento, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(fFD).addComponent(fDesc).addComponent(fIng)
|
|
||||||
.addComponent(fEgr, GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE)
|
|
||||||
.addComponent(jXDatePicker1, GroupLayout.DEFAULT_SIZE,
|
|
||||||
GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
|
||||||
.addGroup(panelCartolaLayout.createSequentialGroup()
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(lFD1).addComponent(lEgr1, GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(lIng1, GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(lDesc1, GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(lDocumento1, GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(lFecha3, GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(lFecha4, GroupLayout.Alignment.TRAILING))
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelCartolaLayout
|
|
||||||
.createParallelGroup(GroupLayout.Alignment.LEADING, false)
|
|
||||||
.addComponent(documento1, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(fFD1).addComponent(fDesc1).addComponent(fIng1)
|
|
||||||
.addComponent(fEgr1, GroupLayout.PREFERRED_SIZE, 170,
|
|
||||||
GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(fNumber).addComponent(jXDatePicker2,
|
|
||||||
GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
|
|
||||||
Short.MAX_VALUE)))
|
|
||||||
.addGroup(panelCartolaLayout.createSequentialGroup().addComponent(añadir).addGap(125,
|
|
||||||
125, 125))
|
|
||||||
.addGroup(panelCartolaLayout.createSequentialGroup().addComponent(modificar).addGap(105,
|
|
||||||
105, 105)))
|
|
||||||
.addGap(62, 62, 62)));
|
|
||||||
panelCartolaLayout.setVerticalGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(panelCartolaLayout.createSequentialGroup().addGroup(panelCartolaLayout
|
|
||||||
.createParallelGroup(GroupLayout.Alignment.TRAILING)
|
|
||||||
.addGroup(panelCartolaLayout.createSequentialGroup().addGap(40, 40, 40)
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(lFecha2).addComponent(jXDatePicker1, GroupLayout.PREFERRED_SIZE,
|
|
||||||
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(lDocumento).addComponent(documento, GroupLayout.PREFERRED_SIZE,
|
|
||||||
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(lFD).addComponent(fFD, GroupLayout.PREFERRED_SIZE,
|
|
||||||
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(lDesc).addComponent(fDesc, GroupLayout.PREFERRED_SIZE,
|
|
||||||
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(lIng).addComponent(fIng, GroupLayout.PREFERRED_SIZE,
|
|
||||||
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(fEgr, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
|
|
||||||
GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(lEgr))
|
|
||||||
.addGap(18, 18, 18).addComponent(añadir)
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 61, Short.MAX_VALUE)
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(lFecha4).addComponent(fNumber, GroupLayout.PREFERRED_SIZE,
|
|
||||||
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(lFecha3).addComponent(jXDatePicker2, GroupLayout.PREFERRED_SIZE,
|
|
||||||
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(lDocumento1).addComponent(documento1, GroupLayout.PREFERRED_SIZE,
|
|
||||||
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(lFD1).addComponent(fFD1, GroupLayout.PREFERRED_SIZE,
|
|
||||||
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(lDesc1).addComponent(fDesc1, GroupLayout.PREFERRED_SIZE,
|
|
||||||
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(lIng1).addComponent(fIng1, GroupLayout.PREFERRED_SIZE,
|
|
||||||
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelCartolaLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(fEgr1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
|
|
||||||
GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(lEgr1))
|
|
||||||
.addGap(18, 18, 18).addComponent(modificar))
|
|
||||||
.addGroup(GroupLayout.Alignment.LEADING,
|
|
||||||
panelCartolaLayout.createSequentialGroup().addGap(20, 20, 20)
|
|
||||||
.addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 478, Short.MAX_VALUE)
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(eliminar)))
|
|
||||||
.addGap(29, 29, 29)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void añadirActionPerformed(ActionEvent evt) {
|
|
||||||
|
|
||||||
ControlPrincipal control = new ControlPrincipal(usuario);
|
|
||||||
SimpleDateFormat formateador = new SimpleDateFormat("dd/MM/yyyy");
|
|
||||||
String fecha = formateador.format(jXDatePicker1.getDate());
|
|
||||||
String documento = this.documento.getSelectedItem().toString();
|
|
||||||
|
|
||||||
String fD = fFD.getText();
|
|
||||||
fFD.setText("");
|
|
||||||
|
|
||||||
String desc = fDesc.getText();
|
|
||||||
fDesc.setText("");
|
|
||||||
|
|
||||||
String ing = fIng.getText();
|
|
||||||
if (ing.equals("")) {
|
|
||||||
ing = "0";
|
|
||||||
} else if (!Validador.isNumber(ing)) {
|
|
||||||
JOptionPane.showMessageDialog(null, "Dato ingresado incorrecto", "Error", JOptionPane.ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
fIng.setText("0");
|
|
||||||
String egr = fEgr.getText();
|
|
||||||
if (egr.equals("")) {
|
|
||||||
egr = "0";
|
|
||||||
} else if (!Validador.isNumber(egr)) {
|
|
||||||
JOptionPane.showMessageDialog(null, "Dato ingresado incorrecto", "Error", JOptionPane.ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
fEgr.setText("0");
|
|
||||||
|
|
||||||
control.añadir(fecha, documento, fD, desc, ing, egr);
|
|
||||||
|
|
||||||
tabla.actTabla();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void eliminarActionPerformed(ActionEvent evt) {
|
|
||||||
ControlPrincipal control = new ControlPrincipal(usuario);
|
|
||||||
if (tabla.getSelectedRow() != -1) {
|
|
||||||
control.eliminarFila((String) tabla.getValueAt(tabla.getSelectedRow(), 0));
|
|
||||||
tabla.actTabla();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void modificarActionPerformed(ActionEvent evt) {
|
|
||||||
|
|
||||||
if(!fNumber.getText().equals("")){
|
|
||||||
|
|
||||||
System.out.println("Entro");
|
|
||||||
SimpleDateFormat formateador = new SimpleDateFormat("dd/MM/yyyy");
|
|
||||||
|
|
||||||
String number = fNumber.getText();
|
|
||||||
String fecha = formateador.format(jXDatePicker2.getDate());
|
|
||||||
String documento = this.documento1.getSelectedItem().toString();
|
|
||||||
String fD = fFD1.getText();
|
|
||||||
String desc = fDesc1.getText();
|
|
||||||
String ing = fIng1.getText();
|
|
||||||
|
|
||||||
if (ing.equals("")) {
|
|
||||||
ing = "0";
|
|
||||||
} else if (!Validador.isNumber(ing)) {
|
|
||||||
JOptionPane.showMessageDialog(null, "Dato ingresado incorrecto", "Error", JOptionPane.ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
String egr = fEgr1.getText();
|
|
||||||
if (egr.equals("")) {
|
|
||||||
egr = "0";
|
|
||||||
} else if (!Validador.isNumber(egr)) {
|
|
||||||
JOptionPane.showMessageDialog(null, "Dato ingresado incorrecto", "Error", JOptionPane.ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
ControlPrincipal control = new ControlPrincipal(usuario);
|
|
||||||
|
|
||||||
control.modificarFila(number, fecha, documento, fD, desc, ing, egr);
|
|
||||||
|
|
||||||
tabla.actTabla();
|
|
||||||
|
|
||||||
}else{
|
|
||||||
JOptionPane.showMessageDialog(null, "No se ingreso el Nº");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,151 +0,0 @@
|
|||||||
package visual;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.Font;
|
|
||||||
import java.awt.event.ActionEvent;
|
|
||||||
import java.awt.event.ActionListener;
|
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
|
|
||||||
public class PanelPrincipal extends JPanel {
|
|
||||||
|
|
||||||
private JLabel pam;
|
|
||||||
|
|
||||||
private JButton cartola;
|
|
||||||
private JButton resumen;
|
|
||||||
|
|
||||||
private JLabel lUsuario;
|
|
||||||
private JLabel lFecha1;
|
|
||||||
|
|
||||||
private JTextField fUsuario;
|
|
||||||
private JTextField fFecha;
|
|
||||||
|
|
||||||
private String usuario;
|
|
||||||
|
|
||||||
public PanelPrincipal(String usuario) {
|
|
||||||
|
|
||||||
this.usuario = usuario;
|
|
||||||
iniciar();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void iniciar() {
|
|
||||||
|
|
||||||
pam = new JLabel();
|
|
||||||
pam.setFont(new Font("LM Roman Caps 10", 1, 60)); // NOI18N
|
|
||||||
pam.setIcon(new ImageIcon(getClass().getResource("P.A.M.v2/logo.png"))); // NOI18N
|
|
||||||
|
|
||||||
cartola = new JButton();
|
|
||||||
cartola.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
cartola.setIcon(new ImageIcon(getClass().getResource("P.A.M.v2/catola.png"))); // NOI18N
|
|
||||||
cartola.setText("Cartola");
|
|
||||||
cartola.setMaximumSize(new Dimension(50, 17));
|
|
||||||
cartola.setMinimumSize(new Dimension(50, 17));
|
|
||||||
cartola.setPreferredSize(new Dimension(50, 17));
|
|
||||||
cartola.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent evt) {
|
|
||||||
cartolaActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
resumen = new JButton();
|
|
||||||
resumen.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
resumen.setIcon(new ImageIcon(getClass().getResource("P.A.M.v2/resumen.png"))); // NOI18N
|
|
||||||
resumen.setText("Resumen");
|
|
||||||
resumen.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent evt) {
|
|
||||||
resumenActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
lUsuario = new JLabel();
|
|
||||||
lUsuario.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lUsuario.setForeground(new Color(0, 204, 204));
|
|
||||||
lUsuario.setText("Usuario");
|
|
||||||
|
|
||||||
lFecha1 = new JLabel();
|
|
||||||
lFecha1.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lFecha1.setForeground(new Color(0, 204, 204));
|
|
||||||
lFecha1.setText("Fecha");
|
|
||||||
|
|
||||||
fUsuario = new JTextField();
|
|
||||||
fUsuario.setText(usuario);
|
|
||||||
fUsuario.setEditable(false);
|
|
||||||
fUsuario.setFocusable(false);
|
|
||||||
|
|
||||||
fFecha = new JTextField();
|
|
||||||
fFecha.setEditable(false);
|
|
||||||
fFecha.setFocusable(false);
|
|
||||||
|
|
||||||
Calendar c = Calendar.getInstance();
|
|
||||||
fFecha.setText(String.valueOf(c.get(Calendar.DATE)) + "/" + String.valueOf(c.get(Calendar.MONTH)) + "/"
|
|
||||||
+ String.valueOf(c.get(Calendar.YEAR)));
|
|
||||||
|
|
||||||
setBackground(new Color(21, 21, 21));
|
|
||||||
|
|
||||||
GroupLayout panelPrincipalLayout = new GroupLayout(this);
|
|
||||||
setLayout(panelPrincipalLayout);
|
|
||||||
panelPrincipalLayout.setHorizontalGroup(panelPrincipalLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(panelPrincipalLayout.createSequentialGroup().addGap(21, 21, 21).addComponent(pam)
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE,
|
|
||||||
Short.MAX_VALUE)
|
|
||||||
.addComponent(cartola, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(18, 18, 18)
|
|
||||||
.addComponent(resumen, GroupLayout.PREFERRED_SIZE, 107, GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE,
|
|
||||||
Short.MAX_VALUE)
|
|
||||||
.addGroup(panelPrincipalLayout.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
|
|
||||||
.addComponent(lUsuario).addComponent(lFecha1))
|
|
||||||
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelPrincipalLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
|
|
||||||
.addComponent(fFecha).addComponent(fUsuario, GroupLayout.PREFERRED_SIZE, 123,
|
|
||||||
GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGap(23, 23, 23)));
|
|
||||||
panelPrincipalLayout.setVerticalGroup(panelPrincipalLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(GroupLayout.Alignment.TRAILING, panelPrincipalLayout.createSequentialGroup()
|
|
||||||
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addGroup(panelPrincipalLayout
|
|
||||||
.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(
|
|
||||||
pam)
|
|
||||||
.addGroup(panelPrincipalLayout.createSequentialGroup().addGap(7, 7, 7)
|
|
||||||
.addGroup(panelPrincipalLayout
|
|
||||||
.createParallelGroup(GroupLayout.Alignment.TRAILING)
|
|
||||||
.addGroup(panelPrincipalLayout.createSequentialGroup()
|
|
||||||
.addGroup(panelPrincipalLayout
|
|
||||||
.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(lUsuario).addComponent(fUsuario,
|
|
||||||
GroupLayout.PREFERRED_SIZE,
|
|
||||||
GroupLayout.DEFAULT_SIZE,
|
|
||||||
GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGap(6, 6, 6)
|
|
||||||
.addGroup(panelPrincipalLayout
|
|
||||||
.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(lFecha1).addComponent(fFecha,
|
|
||||||
GroupLayout.PREFERRED_SIZE,
|
|
||||||
GroupLayout.DEFAULT_SIZE,
|
|
||||||
GroupLayout.PREFERRED_SIZE)))
|
|
||||||
.addGroup(panelPrincipalLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(cartola, GroupLayout.PREFERRED_SIZE, 27,
|
|
||||||
GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(resumen, GroupLayout.PREFERRED_SIZE, 27,
|
|
||||||
GroupLayout.PREFERRED_SIZE)))))));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void resumenActionPerformed(ActionEvent evt) {
|
|
||||||
|
|
||||||
FramePrincipal parent = (FramePrincipal) SwingUtilities.getWindowAncestor(this);
|
|
||||||
parent.actResumen();
|
|
||||||
parent.openResumen();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void cartolaActionPerformed(ActionEvent evt) {
|
|
||||||
|
|
||||||
FramePrincipal parent = (FramePrincipal) SwingUtilities.getWindowAncestor(this);
|
|
||||||
parent.openCartola();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,591 +0,0 @@
|
|||||||
package visual;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.*;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import javax.swing.*;
|
|
||||||
import org.jfree.chart.*;
|
|
||||||
import org.jfree.chart.plot.PlotOrientation;
|
|
||||||
import org.jfree.data.category.DefaultCategoryDataset;
|
|
||||||
|
|
||||||
import utiles.ControlPrincipal;
|
|
||||||
|
|
||||||
public class PanelResumen extends JPanel {
|
|
||||||
|
|
||||||
private JPanel graph;
|
|
||||||
private ChartPanel graphDoc;
|
|
||||||
private ChartPanel graphMes;
|
|
||||||
|
|
||||||
private JLabel lIng;
|
|
||||||
private JLabel lSaldo;
|
|
||||||
private JLabel lEgr2;
|
|
||||||
private JLabel lBalance;
|
|
||||||
private JLabel select;
|
|
||||||
|
|
||||||
private ArrayList<JLabel> mes;
|
|
||||||
private ArrayList<JTextField> egresos;
|
|
||||||
private ArrayList<JTextField> ingresos;
|
|
||||||
private ArrayList<JTextField> saldos;
|
|
||||||
|
|
||||||
private JComboBox<String> tipoGraph;
|
|
||||||
|
|
||||||
private DefaultCategoryDataset dataSetMes;
|
|
||||||
private DefaultCategoryDataset dataSetDoc;
|
|
||||||
|
|
||||||
private String usuario;
|
|
||||||
|
|
||||||
public PanelResumen(String usuario) {
|
|
||||||
|
|
||||||
this.usuario = usuario;
|
|
||||||
iniciar();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void iniciar() {
|
|
||||||
|
|
||||||
iniciarTextFieldYLabel();
|
|
||||||
|
|
||||||
setBackground(new Color(21, 21, 21));
|
|
||||||
setForeground(new Color(255, 255, 255));
|
|
||||||
|
|
||||||
graphMes = crearGraphMes();
|
|
||||||
graphDoc = crearGraphDoc();
|
|
||||||
|
|
||||||
graph = new JPanel();
|
|
||||||
graph.setBackground(new Color(153, 153, 153));
|
|
||||||
graph.setLayout(new CardLayout());
|
|
||||||
graph.add(graphMes, "Mes");
|
|
||||||
graph.add(graphDoc, "Documento");
|
|
||||||
|
|
||||||
lIng = new JLabel();
|
|
||||||
lIng.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lIng.setForeground(new Color(255, 255, 255));
|
|
||||||
lIng.setText("Ingresos");
|
|
||||||
|
|
||||||
lSaldo = new JLabel();
|
|
||||||
lSaldo.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lSaldo.setForeground(new Color(255, 255, 255));
|
|
||||||
lSaldo.setText("Saldo");
|
|
||||||
|
|
||||||
lEgr2 = new JLabel();
|
|
||||||
lEgr2.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
lEgr2.setForeground(new Color(255, 255, 255));
|
|
||||||
lEgr2.setText("Egresos");
|
|
||||||
|
|
||||||
lBalance = new JLabel();
|
|
||||||
lBalance.setFont(new Font("Eras Light ITC", 0, 36)); // NOI18N
|
|
||||||
lBalance.setForeground(new Color(255, 255, 255));
|
|
||||||
lBalance.setText("Balance Mensual");
|
|
||||||
|
|
||||||
select = new JLabel();
|
|
||||||
select.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
select.setForeground(new Color(255, 255, 255));
|
|
||||||
select.setText("Seleccionar Grafico:");
|
|
||||||
|
|
||||||
tipoGraph = new JComboBox<>();
|
|
||||||
tipoGraph.setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
tipoGraph.setModel(new DefaultComboBoxModel<>(new String[] { "Mes", "Documento" }));
|
|
||||||
tipoGraph.addActionListener(new ActionListener() {
|
|
||||||
public void actionPerformed(ActionEvent evt) {
|
|
||||||
|
|
||||||
comboActionPerformed(evt);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
GroupLayout panelResumenLayout = new GroupLayout(this);
|
|
||||||
setLayout(panelResumenLayout);
|
|
||||||
panelResumenLayout
|
|
||||||
.setHorizontalGroup(panelResumenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
|
|
||||||
panelResumenLayout.createSequentialGroup().addContainerGap().addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(lIng, javax.swing.GroupLayout.Alignment.TRAILING).addGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.TRAILING, panelResumenLayout
|
|
||||||
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(lSaldo).addComponent(lEgr2)))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24,
|
|
||||||
Short.MAX_VALUE)
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelResumenLayout
|
|
||||||
.createSequentialGroup()
|
|
||||||
.addComponent(lBalance, javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
310, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(116, 116, 116))
|
|
||||||
.addGroup(panelResumenLayout.createSequentialGroup()
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(saldos.get(0),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE, 63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(egresos.get(0),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE, 63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(ingresos.get(0),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE, 63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(mes.get(0)))
|
|
||||||
.addGap(18, 18, 18)
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(mes.get(1))
|
|
||||||
.addComponent(saldos.get(1),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE, 63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(egresos.get(1),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE, 63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(ingresos.get(1),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE, 63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGap(18, 18, 18)
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(mes.get(2))
|
|
||||||
.addGroup(panelResumenLayout.createSequentialGroup()
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(saldos.get(2),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(egresos.get(2),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(ingresos.get(2),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGap(18, 18, 18)
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createSequentialGroup()
|
|
||||||
.addComponent(saldos.get(3),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(18, 18, 18)
|
|
||||||
.addComponent(saldos.get(4),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(18, 18, 18)
|
|
||||||
.addComponent(saldos.get(5),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createSequentialGroup()
|
|
||||||
.addComponent(egresos.get(3),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(18, 18, 18)
|
|
||||||
.addComponent(egresos.get(4),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(18, 18, 18)
|
|
||||||
.addComponent(egresos.get(5),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createSequentialGroup()
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(
|
|
||||||
ingresos.get(3),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(
|
|
||||||
mes.get(3)))
|
|
||||||
.addGap(18, 18, 18)
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(
|
|
||||||
ingresos.get(4),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(
|
|
||||||
mes.get(4)))
|
|
||||||
.addGap(18, 18, 18)
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(
|
|
||||||
mes.get(5))
|
|
||||||
.addComponent(
|
|
||||||
ingresos.get(5),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
63,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE))))))
|
|
||||||
.addGap(35, 35, 35)))
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(panelResumenLayout.createSequentialGroup()
|
|
||||||
.addComponent(select).addGap(4, 4, 4)
|
|
||||||
.addComponent(tipoGraph, javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addComponent(graph, javax.swing.GroupLayout.PREFERRED_SIZE, 719,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGap(6, 6, 6)));
|
|
||||||
panelResumenLayout
|
|
||||||
.setVerticalGroup(
|
|
||||||
panelResumenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(
|
|
||||||
panelResumenLayout
|
|
||||||
.createSequentialGroup().addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(graph, javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
449, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGroup(panelResumenLayout.createSequentialGroup().addGap(50,
|
|
||||||
50, 50)
|
|
||||||
.addComponent(lBalance,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE, 52,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(40, 40, 40)
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(mes.get(0)).addComponent(mes.get(1))
|
|
||||||
.addComponent(mes.get(2)).addComponent(mes.get(3))
|
|
||||||
.addComponent(mes.get(4)).addComponent(mes.get(5)))
|
|
||||||
.addPreferredGap(
|
|
||||||
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createSequentialGroup()
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(ingresos.get(0),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(ingresos.get(1),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(ingresos.get(3),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(ingresos.get(4),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(ingresos.get(5),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(
|
|
||||||
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(egresos.get(0),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(egresos.get(1),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(egresos.get(3),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(egresos.get(4),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(egresos.get(5),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(
|
|
||||||
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(saldos.get(0),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(saldos.get(1),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(saldos.get(3),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(saldos.get(4),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(saldos.get(5),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createSequentialGroup()
|
|
||||||
.addComponent(lIng)
|
|
||||||
.addPreferredGap(
|
|
||||||
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(
|
|
||||||
javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createSequentialGroup()
|
|
||||||
.addGap(26, 26, 26)
|
|
||||||
.addComponent(lSaldo))
|
|
||||||
.addComponent(lEgr2)))
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createSequentialGroup()
|
|
||||||
.addComponent(ingresos.get(2),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(
|
|
||||||
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(egresos.get(2),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(
|
|
||||||
javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(saldos.get(2),
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
|
||||||
.addGap(43, 43, 43)
|
|
||||||
.addGroup(panelResumenLayout
|
|
||||||
.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(tipoGraph, javax.swing.GroupLayout.PREFERRED_SIZE,
|
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE,
|
|
||||||
javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(select))
|
|
||||||
.addGap(0, 65, Short.MAX_VALUE)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void iniciarTextFieldYLabel() {
|
|
||||||
|
|
||||||
ingresos = new ArrayList<JTextField>();
|
|
||||||
egresos = new ArrayList<JTextField>();
|
|
||||||
saldos = new ArrayList<JTextField>();
|
|
||||||
mes = new ArrayList<JLabel>();
|
|
||||||
|
|
||||||
for (int x = 0; x < 6; x++) {
|
|
||||||
|
|
||||||
ingresos.add(new JTextField());
|
|
||||||
egresos.add(new JTextField());
|
|
||||||
saldos.add(new JTextField());
|
|
||||||
ingresos.get(x).setBackground(new Color(0, 204, 204));
|
|
||||||
ingresos.get(x).setVisible(false);
|
|
||||||
ingresos.get(x).setEditable(false);
|
|
||||||
egresos.get(x).setBackground(new Color(0, 204, 204));
|
|
||||||
egresos.get(x).setVisible(false);
|
|
||||||
egresos.get(x).setEditable(false);
|
|
||||||
saldos.get(x).setBackground(new Color(0, 204, 204));
|
|
||||||
saldos.get(x).setVisible(false);
|
|
||||||
saldos.get(x).setEditable(false);
|
|
||||||
mes.add(new JLabel());
|
|
||||||
mes.get(x).setFont(new Font("Eras Light ITC", 0, 14)); // NOI18N
|
|
||||||
mes.get(x).setForeground(new Color(255, 255, 255));
|
|
||||||
mes.get(x).setText("Mes");
|
|
||||||
mes.get(x).setVisible(false);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void comboActionPerformed(ActionEvent evt) {
|
|
||||||
|
|
||||||
CardLayout cardLayout = (CardLayout) graph.getLayout();
|
|
||||||
cardLayout.show(graph, (String) tipoGraph.getSelectedItem());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void llenarResumen() {
|
|
||||||
|
|
||||||
ControlPrincipal control = new ControlPrincipal(usuario);
|
|
||||||
String[][] resumen = control.resumenMes();
|
|
||||||
|
|
||||||
if (resumen[0][0] != null) {
|
|
||||||
|
|
||||||
for (int x = resumen[0].length - 1, z = 0; x > resumen[0].length - 7 && x >= 0; x--, z++) {
|
|
||||||
|
|
||||||
ingresos.get(z).setText(resumen[2][x]);
|
|
||||||
ingresos.get(z).setVisible(true);
|
|
||||||
egresos.get(z).setText(resumen[3][x]);
|
|
||||||
egresos.get(z).setVisible(true);
|
|
||||||
saldos.get(z).setText(resumen[1][x]);
|
|
||||||
saldos.get(z).setVisible(true);
|
|
||||||
|
|
||||||
if (resumen[0][x].matches("[0-9]{4}-01")) {
|
|
||||||
|
|
||||||
mes.get(z).setText("Enero");
|
|
||||||
mes.get(z).setVisible(true);
|
|
||||||
|
|
||||||
} else if (resumen[0][x].matches("[0-9]{4}-02")) {
|
|
||||||
|
|
||||||
mes.get(z).setText("Febrero");
|
|
||||||
mes.get(z).setVisible(true);
|
|
||||||
|
|
||||||
} else if (resumen[0][x].matches("[0-9]{4}-03")) {
|
|
||||||
|
|
||||||
mes.get(z).setText("Marzo");
|
|
||||||
mes.get(z).setVisible(true);
|
|
||||||
|
|
||||||
} else if (resumen[0][x].matches("[0-9]{4}-04")) {
|
|
||||||
|
|
||||||
mes.get(z).setText("Abril");
|
|
||||||
mes.get(z).setVisible(true);
|
|
||||||
|
|
||||||
} else if (resumen[0][x].matches("[0-9]{4}-05")) {
|
|
||||||
|
|
||||||
mes.get(z).setText("Mayo");
|
|
||||||
mes.get(z).setVisible(true);
|
|
||||||
|
|
||||||
} else if (resumen[0][x].matches("[0-9]{4}-06")) {
|
|
||||||
|
|
||||||
mes.get(z).setText("Junio");
|
|
||||||
mes.get(z).setVisible(true);
|
|
||||||
|
|
||||||
} else if (resumen[0][x].matches("[0-9]{4}-07")) {
|
|
||||||
|
|
||||||
mes.get(z).setText("Julio");
|
|
||||||
mes.get(z).setVisible(true);
|
|
||||||
|
|
||||||
} else if (resumen[0][x].matches("[0-9]{4}-08")) {
|
|
||||||
|
|
||||||
mes.get(z).setText("Agosto");
|
|
||||||
mes.get(z).setVisible(true);
|
|
||||||
|
|
||||||
} else if (resumen[0][x].matches("[0-9]{4}-09")) {
|
|
||||||
|
|
||||||
mes.get(z).setText("Septiembre");
|
|
||||||
mes.get(z).setVisible(true);
|
|
||||||
|
|
||||||
} else if (resumen[0][x].matches("[0-9]{4}-10")) {
|
|
||||||
|
|
||||||
mes.get(z).setText("Octubre");
|
|
||||||
mes.get(z).setVisible(true);
|
|
||||||
|
|
||||||
} else if (resumen[0][x].matches("[0-9]{4}-11")) {
|
|
||||||
|
|
||||||
mes.get(z).setText("Noviembre");
|
|
||||||
mes.get(z).setVisible(true);
|
|
||||||
|
|
||||||
} else if (resumen[0][x].matches("[0-9]{4}-12")) {
|
|
||||||
|
|
||||||
mes.get(z).setText("Diciembre");
|
|
||||||
mes.get(z).setVisible(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private ChartPanel crearGraphMes() {
|
|
||||||
|
|
||||||
ControlPrincipal control = new ControlPrincipal(usuario);
|
|
||||||
String[][] resumen = control.resumenMes();
|
|
||||||
|
|
||||||
dataSetMes = new DefaultCategoryDataset();
|
|
||||||
|
|
||||||
if (resumen[0][0] != null) {
|
|
||||||
|
|
||||||
for (int x = 0; x < resumen[0].length; x++) {
|
|
||||||
|
|
||||||
dataSetMes.setValue(Integer.parseInt(resumen[1][x]), "Saldo", resumen[0][x]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
JFreeChart chart = ChartFactory.createBarChart("Resumen Mensual", "Mes", "Saldo", dataSetMes,
|
|
||||||
PlotOrientation.VERTICAL, false, true, false);
|
|
||||||
|
|
||||||
chart.getPlot().setBackgroundPaint(new Color(0, 204, 204));
|
|
||||||
chart.getCategoryPlot().getRenderer().setSeriesPaint(0, new Color(21, 21, 21));
|
|
||||||
chart.setBackgroundPaint(new Color(0, 204, 204));
|
|
||||||
|
|
||||||
ChartPanel graph = new ChartPanel(chart);
|
|
||||||
return graph;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private ChartPanel crearGraphDoc() {
|
|
||||||
|
|
||||||
ControlPrincipal control = new ControlPrincipal(usuario);
|
|
||||||
int[] resumen = control.resumenDoc();
|
|
||||||
|
|
||||||
dataSetDoc = new DefaultCategoryDataset();
|
|
||||||
dataSetDoc.setValue(resumen[0], "Saldo", "Efectivo");
|
|
||||||
dataSetDoc.setValue(resumen[1], "Saldo", "Transferencia");
|
|
||||||
dataSetDoc.setValue(resumen[2], "Saldo", "Credito");
|
|
||||||
|
|
||||||
JFreeChart chart = ChartFactory.createBarChart("Resumen por Documentos", "Documento", "Saldo", dataSetDoc,
|
|
||||||
PlotOrientation.VERTICAL, false, true, false);
|
|
||||||
|
|
||||||
chart.getPlot().setBackgroundPaint(new Color(0, 204, 204));
|
|
||||||
chart.getCategoryPlot().getRenderer().setSeriesPaint(0, new Color(21, 21, 21));
|
|
||||||
chart.setBackgroundPaint(new Color(0, 204, 204));
|
|
||||||
|
|
||||||
ChartPanel graph = new ChartPanel(chart);
|
|
||||||
return graph;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void actualizarGraphMes() {
|
|
||||||
|
|
||||||
dataSetMes.clear();
|
|
||||||
|
|
||||||
ControlPrincipal control = new ControlPrincipal(usuario);
|
|
||||||
String[][] resumen = control.resumenMes();
|
|
||||||
|
|
||||||
if (resumen[0][0] != null) {
|
|
||||||
|
|
||||||
for (int x = 0; x < resumen[0].length; x++) {
|
|
||||||
|
|
||||||
dataSetMes.setValue(Integer.parseInt(resumen[1][x]), "Saldo", resumen[0][x]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void actualizarGraphDoc() {
|
|
||||||
ControlPrincipal control = new ControlPrincipal(usuario);
|
|
||||||
|
|
||||||
dataSetDoc.clear();
|
|
||||||
|
|
||||||
int[] resumen = control.resumenDoc();
|
|
||||||
|
|
||||||
dataSetDoc.setValue(resumen[0], "Saldo", "Efectivo");
|
|
||||||
dataSetDoc.setValue(resumen[1], "Saldo", "Transferencia");
|
|
||||||
dataSetDoc.setValue(resumen[2], "Saldo", "Credito");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,161 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
163
src/visualV2/FrameAdministrador.java
Normal file
163
src/visualV2/FrameAdministrador.java
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
package visualV2;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.table.*;
|
||||||
|
|
||||||
|
import control.ControlAdmin;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.*;
|
||||||
|
|
||||||
|
public class FrameAdministrador extends JFrame {
|
||||||
|
|
||||||
|
private JButton bCrear;
|
||||||
|
private JButton bModificar;
|
||||||
|
private JScrollPane jScrollPane1;
|
||||||
|
private JPanel panel;
|
||||||
|
private JTable tabla;
|
||||||
|
|
||||||
|
public FrameAdministrador() {
|
||||||
|
initComponents();
|
||||||
|
actTabla();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initComponents() {
|
||||||
|
|
||||||
|
panel = new JPanel();
|
||||||
|
jScrollPane1 = new JScrollPane();
|
||||||
|
tabla = new JTable();
|
||||||
|
bModificar = new JButton();
|
||||||
|
bCrear = new JButton();
|
||||||
|
|
||||||
|
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||||
|
addWindowListener(new WindowAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent e) {
|
||||||
|
new FrameLogin();
|
||||||
|
setVisible(false);
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
panel.setBackground(new Color(0, 128, 128));
|
||||||
|
|
||||||
|
jScrollPane1.setBackground(new Color(128, 203, 196));
|
||||||
|
|
||||||
|
tabla.setBackground(new Color(178, 223, 219));
|
||||||
|
tabla.setFont(new Font("Candara", 0, 13)); // NOI18N
|
||||||
|
tabla.setForeground(new Color(21, 21, 21));
|
||||||
|
tabla.setModel(
|
||||||
|
new DefaultTableModel(new Object[][] { { null, null } }, new String[] { "Usuario", "Contraseña" }) {
|
||||||
|
boolean[] canEdit = new boolean[] { false, false };
|
||||||
|
|
||||||
|
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||||
|
return canEdit[columnIndex];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tabla.setGridColor(new Color(255, 255, 255));
|
||||||
|
tabla.setOpaque(false);
|
||||||
|
tabla.setSelectionForeground(new Color(0, 120, 215));
|
||||||
|
jScrollPane1.setViewportView(tabla);
|
||||||
|
|
||||||
|
bModificar.setBackground(new Color(33, 150, 243));
|
||||||
|
bModificar.setText("Modificar usuario");
|
||||||
|
bModificar.setContentAreaFilled(false);
|
||||||
|
bModificar.setOpaque(true);
|
||||||
|
bModificar.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent evt) {
|
||||||
|
|
||||||
|
bModificarActionPerformed(evt);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
bCrear.setBackground(new Color(33, 150, 243));
|
||||||
|
bCrear.setText("Crear Usuario");
|
||||||
|
bCrear.setContentAreaFilled(false);
|
||||||
|
bCrear.setOpaque(true);
|
||||||
|
bCrear.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent evt) {
|
||||||
|
|
||||||
|
bCrearActionPerformed(evt);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
GroupLayout panelLayout = new GroupLayout(panel);
|
||||||
|
panel.setLayout(panelLayout);
|
||||||
|
panelLayout
|
||||||
|
.setHorizontalGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(GroupLayout.Alignment.TRAILING, panelLayout.createSequentialGroup().addContainerGap()
|
||||||
|
.addComponent(bCrear, GroupLayout.PREFERRED_SIZE, 178, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
|
.addComponent(bModificar, GroupLayout.PREFERRED_SIZE, 177, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addContainerGap())
|
||||||
|
.addGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(panelLayout.createSequentialGroup().addContainerGap()
|
||||||
|
.addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
|
||||||
|
.addContainerGap())));
|
||||||
|
panelLayout.setVerticalGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(GroupLayout.Alignment.TRAILING,
|
||||||
|
panelLayout.createSequentialGroup().addContainerGap(447, Short.MAX_VALUE)
|
||||||
|
.addGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(bModificar).addComponent(bCrear))
|
||||||
|
.addContainerGap())
|
||||||
|
.addGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(panelLayout.createSequentialGroup()
|
||||||
|
.addContainerGap().addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE,
|
||||||
|
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addContainerGap(43, Short.MAX_VALUE))));
|
||||||
|
|
||||||
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
|
getContentPane().setLayout(layout);
|
||||||
|
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(panel,
|
||||||
|
GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
|
||||||
|
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addComponent(panel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addGap(0, 0, 0)));
|
||||||
|
pack();
|
||||||
|
setVisible(true);
|
||||||
|
setLocationRelativeTo(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void bCrearActionPerformed(ActionEvent evt) {
|
||||||
|
new FrameCrear();
|
||||||
|
setVisible(false);
|
||||||
|
dispose();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void bModificarActionPerformed(ActionEvent evt) {
|
||||||
|
new FrameModificar();
|
||||||
|
setVisible(false);
|
||||||
|
dispose();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actTabla() {
|
||||||
|
|
||||||
|
ControlAdmin control = new ControlAdmin();
|
||||||
|
DefaultTableModel modelo = (DefaultTableModel) tabla.getModel();
|
||||||
|
|
||||||
|
tabla.setModel(modelo);
|
||||||
|
modelo.setRowCount(0);
|
||||||
|
|
||||||
|
for (int x = 0; x < control.getRowCount(); x++) {
|
||||||
|
|
||||||
|
Object[] fila = control.getRow(x);
|
||||||
|
modelo.addRow(fila);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
109
src/visualV2/FrameCrear.java
Normal file
109
src/visualV2/FrameCrear.java
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
package visualV2;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
import control.ControlAdmin;
|
||||||
|
|
||||||
|
import java.awt.event.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class FrameCrear extends JFrame {
|
||||||
|
|
||||||
|
private JButton bCrear;
|
||||||
|
private JTextField fContraseña;
|
||||||
|
private JTextField fUsuario;
|
||||||
|
private JLabel lContraseña;
|
||||||
|
private JLabel lUsuario;
|
||||||
|
private JPanel panel;
|
||||||
|
|
||||||
|
public FrameCrear() {
|
||||||
|
initComponents();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initComponents() {
|
||||||
|
|
||||||
|
panel = new JPanel();
|
||||||
|
bCrear = new JButton();
|
||||||
|
lUsuario = new JLabel();
|
||||||
|
lContraseña = new JLabel();
|
||||||
|
fUsuario = new JTextField();
|
||||||
|
fContraseña = new JTextField();
|
||||||
|
|
||||||
|
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
|
panel.setBackground(new Color(0, 128, 128));
|
||||||
|
|
||||||
|
bCrear.setBackground(new Color(33, 150, 243));
|
||||||
|
bCrear.setText("Crear Usuario");
|
||||||
|
bCrear.setContentAreaFilled(false);
|
||||||
|
bCrear.setOpaque(true);
|
||||||
|
bCrear.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent evt) {
|
||||||
|
bCrearActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
lUsuario.setBackground(new Color(0, 204, 204));
|
||||||
|
lUsuario.setFont(new Font("Candara", 1, 14)); // NOI18N
|
||||||
|
lUsuario.setForeground(new Color(255, 255, 255));
|
||||||
|
lUsuario.setText("Usuario:");
|
||||||
|
|
||||||
|
lContraseña.setBackground(new Color(0, 204, 204));
|
||||||
|
lContraseña.setFont(new Font("Candara", 1, 14)); // NOI18N
|
||||||
|
lContraseña.setForeground(new Color(255, 255, 255));
|
||||||
|
lContraseña.setText("Contraseña:");
|
||||||
|
|
||||||
|
fUsuario.setToolTipText("");
|
||||||
|
|
||||||
|
fContraseña.setToolTipText("");
|
||||||
|
|
||||||
|
GroupLayout panelLayout = new GroupLayout(panel);
|
||||||
|
panel.setLayout(panelLayout);
|
||||||
|
panelLayout.setHorizontalGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(panelLayout.createSequentialGroup().addGap(29, 29, 29)
|
||||||
|
.addGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(lContraseña, GroupLayout.Alignment.TRAILING)
|
||||||
|
.addComponent(lUsuario, GroupLayout.Alignment.TRAILING))
|
||||||
|
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
|
.addGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(fContraseña, GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE)
|
||||||
|
.addComponent(fUsuario).addComponent(bCrear, GroupLayout.DEFAULT_SIZE,
|
||||||
|
GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
|
.addGap(48, 48, 48)));
|
||||||
|
panelLayout.setVerticalGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(panelLayout.createSequentialGroup().addGap(21, 21, 21)
|
||||||
|
.addGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(lUsuario).addComponent(fUsuario, GroupLayout.PREFERRED_SIZE,
|
||||||
|
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(lContraseña).addComponent(fContraseña,
|
||||||
|
GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
|
||||||
|
GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(bCrear)
|
||||||
|
.addContainerGap(18, Short.MAX_VALUE)));
|
||||||
|
|
||||||
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
|
getContentPane().setLayout(layout);
|
||||||
|
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(
|
||||||
|
panel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
|
||||||
|
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(layout.createSequentialGroup().addComponent(panel, GroupLayout.DEFAULT_SIZE,
|
||||||
|
GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addGap(0, 0, 0)));
|
||||||
|
|
||||||
|
pack();
|
||||||
|
setVisible(true);
|
||||||
|
setLocationRelativeTo(null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void bCrearActionPerformed(ActionEvent evt) {
|
||||||
|
ControlAdmin control = new ControlAdmin();
|
||||||
|
if(control.añadirUsuario(fUsuario.getText(), fContraseña.getText())){
|
||||||
|
new FrameAdministrador();
|
||||||
|
setVisible(false);
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,46 +2,72 @@ package visualV2;
|
|||||||
|
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import javax.swing.event.MenuEvent;
|
||||||
|
import javax.swing.event.MenuListener;
|
||||||
|
|
||||||
import control.ControlLogin;
|
import control.ControlLogin;
|
||||||
|
|
||||||
public class FrameLogin extends JFrame {
|
public class FrameLogin extends JFrame {
|
||||||
|
|
||||||
private javax.swing.JButton bIngresar;
|
private JButton bIngresar;
|
||||||
private javax.swing.JButton bRegistrar;
|
private JButton bRegistrar;
|
||||||
private javax.swing.JButton bSalir;
|
private JButton bSalir;
|
||||||
private javax.swing.JPanel bar;
|
private JPanel bar;
|
||||||
private javax.swing.JLabel bienvenido;
|
private JLabel bienvenido;
|
||||||
private javax.swing.JPasswordField fContraseña1;
|
private JPasswordField fContraseña1;
|
||||||
private javax.swing.JTextField fUsuario;
|
private JTextField fUsuario;
|
||||||
private javax.swing.JLabel lContraseña;
|
private JLabel lContraseña;
|
||||||
private javax.swing.JLabel lUsuario;
|
private JLabel lUsuario;
|
||||||
private javax.swing.JLabel pam;
|
private JLabel pam;
|
||||||
private javax.swing.JPanel panel;
|
private JPanel panel;
|
||||||
|
private JMenuBar menubar;
|
||||||
|
private JMenu menu;
|
||||||
|
|
||||||
public FrameLogin() {
|
public FrameLogin() {
|
||||||
initComponents();
|
initComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
panel = new javax.swing.JPanel();
|
panel = new JPanel();
|
||||||
pam = new javax.swing.JLabel();
|
pam = new JLabel();
|
||||||
bienvenido = new javax.swing.JLabel();
|
bienvenido = new JLabel();
|
||||||
bar = new javax.swing.JPanel();
|
bar = new JPanel();
|
||||||
lUsuario = new javax.swing.JLabel();
|
lUsuario = new JLabel();
|
||||||
fUsuario = new javax.swing.JTextField();
|
fUsuario = new JTextField();
|
||||||
lContraseña = new javax.swing.JLabel();
|
lContraseña = new JLabel();
|
||||||
fContraseña1 = new javax.swing.JPasswordField();
|
fContraseña1 = new JPasswordField();
|
||||||
bIngresar = new javax.swing.JButton();
|
bIngresar = new JButton();
|
||||||
bRegistrar = new javax.swing.JButton();
|
bRegistrar = new JButton();
|
||||||
bSalir = new javax.swing.JButton();
|
bSalir = new JButton();
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||||
setBackground(new java.awt.Color(21, 21, 21));
|
setBackground(new java.awt.Color(21, 21, 21));
|
||||||
setMaximumSize(null);
|
|
||||||
setMinimumSize(null);
|
|
||||||
|
|
||||||
|
menubar = new JMenuBar();
|
||||||
|
menu = new JMenu("Administrador");
|
||||||
|
|
||||||
|
menu.addMenuListener(new MenuListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void menuSelected(MenuEvent e) {
|
||||||
|
|
||||||
|
openAdmin();
|
||||||
|
menu.setSelected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void menuDeselected(MenuEvent e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void menuCanceled(MenuEvent e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
menubar.add(menu);
|
||||||
|
setJMenuBar(menubar);
|
||||||
|
|
||||||
panel.setBackground(new java.awt.Color(0, 128, 128));
|
panel.setBackground(new java.awt.Color(0, 128, 128));
|
||||||
|
|
||||||
pam.setFont(new java.awt.Font("Candara", 1, 60)); // NOI18N
|
pam.setFont(new java.awt.Font("Candara", 1, 60)); // NOI18N
|
||||||
@@ -55,14 +81,14 @@ public class FrameLogin extends JFrame {
|
|||||||
bar.setBackground(new java.awt.Color(255, 255, 255));
|
bar.setBackground(new java.awt.Color(255, 255, 255));
|
||||||
bar.setPreferredSize(new java.awt.Dimension(215, 2));
|
bar.setPreferredSize(new java.awt.Dimension(215, 2));
|
||||||
|
|
||||||
javax.swing.GroupLayout barLayout = new javax.swing.GroupLayout(bar);
|
GroupLayout barLayout = new GroupLayout(bar);
|
||||||
bar.setLayout(barLayout);
|
bar.setLayout(barLayout);
|
||||||
barLayout.setHorizontalGroup(
|
barLayout.setHorizontalGroup(
|
||||||
barLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
barLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGap(0, 251, Short.MAX_VALUE)
|
.addGap(0, 251, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
barLayout.setVerticalGroup(
|
barLayout.setVerticalGroup(
|
||||||
barLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
barLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGap(0, 9, Short.MAX_VALUE)
|
.addGap(0, 9, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -97,60 +123,60 @@ public class FrameLogin extends JFrame {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
javax.swing.GroupLayout panelLayout = new javax.swing.GroupLayout(panel);
|
GroupLayout panelLayout = new GroupLayout(panel);
|
||||||
panel.setLayout(panelLayout);
|
panel.setLayout(panelLayout);
|
||||||
panelLayout.setHorizontalGroup(
|
panelLayout.setHorizontalGroup(
|
||||||
panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(panelLayout.createSequentialGroup()
|
.addGroup(panelLayout.createSequentialGroup()
|
||||||
.addGap(95, 95, 95)
|
.addGap(95, 95, 95)
|
||||||
.addGroup(panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
|
.addGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.CENTER)
|
||||||
.addComponent(bar, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(bar, GroupLayout.PREFERRED_SIZE, 251, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(pam)
|
.addComponent(pam)
|
||||||
.addComponent(bRegistrar)
|
.addComponent(bRegistrar)
|
||||||
.addComponent(bienvenido)
|
.addComponent(bienvenido)
|
||||||
.addComponent(bIngresar, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(bIngresar, GroupLayout.PREFERRED_SIZE, 87, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(bSalir, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(bSalir, GroupLayout.PREFERRED_SIZE, 65, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(fUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(fUsuario, GroupLayout.PREFERRED_SIZE, 161, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(lUsuario)
|
.addComponent(lUsuario)
|
||||||
.addComponent(lContraseña)
|
.addComponent(lContraseña)
|
||||||
.addComponent(fContraseña1, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE))
|
.addComponent(fContraseña1, GroupLayout.PREFERRED_SIZE, 161, GroupLayout.PREFERRED_SIZE))
|
||||||
.addContainerGap(94, Short.MAX_VALUE))
|
.addContainerGap(94, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
panelLayout.setVerticalGroup(
|
panelLayout.setVerticalGroup(
|
||||||
panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(panelLayout.createSequentialGroup()
|
.addGroup(panelLayout.createSequentialGroup()
|
||||||
.addGap(29, 29, 29)
|
.addGap(29, 29, 29)
|
||||||
.addComponent(pam, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(pam, GroupLayout.PREFERRED_SIZE, 52, GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(1, 1, 1)
|
.addGap(1, 1, 1)
|
||||||
.addComponent(bienvenido, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(bienvenido, GroupLayout.PREFERRED_SIZE, 35, GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(bar, javax.swing.GroupLayout.PREFERRED_SIZE, 9, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(bar, GroupLayout.PREFERRED_SIZE, 9, GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(13, 13, 13)
|
.addGap(13, 13, 13)
|
||||||
.addComponent(lUsuario)
|
.addComponent(lUsuario)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(fUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(fUsuario, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(lContraseña)
|
.addComponent(lContraseña)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(fContraseña1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(fContraseña1, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(18, 18, 18)
|
.addGap(18, 18, 18)
|
||||||
.addComponent(bIngresar)
|
.addComponent(bIngresar)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(bRegistrar)
|
.addComponent(bRegistrar)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(bSalir)
|
.addComponent(bSalir)
|
||||||
.addContainerGap(17, Short.MAX_VALUE))
|
.addContainerGap(17, Short.MAX_VALUE))
|
||||||
);
|
);
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(panel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addComponent(panel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
);
|
);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -189,7 +215,6 @@ public class FrameLogin extends JFrame {
|
|||||||
|
|
||||||
private void bSalirActionPerformed(ActionEvent evt) {
|
private void bSalirActionPerformed(ActionEvent evt) {
|
||||||
|
|
||||||
|
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -197,10 +222,21 @@ public class FrameLogin extends JFrame {
|
|||||||
private void bRegistrarActionPerformed(ActionEvent evt) {
|
private void bRegistrarActionPerformed(ActionEvent evt) {
|
||||||
|
|
||||||
FrameRegistro registro = new FrameRegistro();
|
FrameRegistro registro = new FrameRegistro();
|
||||||
|
|
||||||
dispose();
|
dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void openAdmin(){
|
||||||
|
String opcion = JOptionPane.showInputDialog("Ingrese codigo de administrador");
|
||||||
|
if(opcion!=null){
|
||||||
|
if(opcion.equals("7419")){
|
||||||
|
new FrameAdministrador();
|
||||||
|
setVisible(false);
|
||||||
|
dispose();
|
||||||
|
}else{
|
||||||
|
JOptionPane.showMessageDialog(null, "Codigo incorrecto");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
159
src/visualV2/FrameModificar.java
Normal file
159
src/visualV2/FrameModificar.java
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
package visualV2;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
|
||||||
|
import control.ControlAdmin;
|
||||||
|
|
||||||
|
import java.awt.event.*;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class FrameModificar extends JFrame {
|
||||||
|
|
||||||
|
private JButton bModificar;
|
||||||
|
private JComboBox<String> boxUsuario;
|
||||||
|
private JTextField fContraseña;
|
||||||
|
private JTextField fUsuario;
|
||||||
|
private JLabel lContraseña;
|
||||||
|
private JLabel lSelectUsuario;
|
||||||
|
private JLabel lUsuario;
|
||||||
|
private JPanel panel;
|
||||||
|
|
||||||
|
public FrameModificar() {
|
||||||
|
initComponents();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initComponents() {
|
||||||
|
|
||||||
|
panel = new JPanel();
|
||||||
|
bModificar = new JButton();
|
||||||
|
lUsuario = new JLabel();
|
||||||
|
lContraseña = new JLabel();
|
||||||
|
fUsuario = new JTextField();
|
||||||
|
fContraseña = new JTextField();
|
||||||
|
boxUsuario = new JComboBox<>();
|
||||||
|
lSelectUsuario = new JLabel();
|
||||||
|
|
||||||
|
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||||
|
addWindowListener(new WindowAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent e) {
|
||||||
|
new FrameAdministrador();
|
||||||
|
setVisible(false);
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
panel.setBackground(new Color(0, 128, 128));
|
||||||
|
|
||||||
|
bModificar.setBackground(new Color(33, 150, 243));
|
||||||
|
bModificar.setText("Modificar");
|
||||||
|
bModificar.setContentAreaFilled(false);
|
||||||
|
bModificar.setOpaque(true);
|
||||||
|
bModificar.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent evt) {
|
||||||
|
bModificarActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
lUsuario.setBackground(new Color(0, 204, 204));
|
||||||
|
lUsuario.setFont(new Font("Candara", 1, 14)); // NOI18N
|
||||||
|
lUsuario.setForeground(new Color(255, 255, 255));
|
||||||
|
lUsuario.setText("Usuario:");
|
||||||
|
|
||||||
|
lContraseña.setBackground(new Color(0, 204, 204));
|
||||||
|
lContraseña.setFont(new Font("Candara", 1, 14)); // NOI18N
|
||||||
|
lContraseña.setForeground(new Color(255, 255, 255));
|
||||||
|
lContraseña.setText("Contraseña:");
|
||||||
|
|
||||||
|
fUsuario.setToolTipText("");
|
||||||
|
|
||||||
|
fContraseña.setToolTipText("");
|
||||||
|
|
||||||
|
boxUsuario.setModel(new DefaultComboBoxModel<>(new String[] {}));
|
||||||
|
llenarBox();
|
||||||
|
boxUsuario.addActionListener(new ActionListener() {
|
||||||
|
public void actionPerformed(ActionEvent evt) {
|
||||||
|
boxUsuarioActionPerformed(evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
boxUsuarioActionPerformed(null);
|
||||||
|
|
||||||
|
lSelectUsuario.setBackground(new Color(0, 204, 204));
|
||||||
|
lSelectUsuario.setFont(new Font("Candara", 1, 14)); // NOI18N
|
||||||
|
lSelectUsuario.setForeground(new Color(255, 255, 255));
|
||||||
|
lSelectUsuario.setText("Seleccione usuario:");
|
||||||
|
|
||||||
|
GroupLayout panelLayout = new GroupLayout(panel);
|
||||||
|
panel.setLayout(panelLayout);
|
||||||
|
panelLayout.setHorizontalGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(panelLayout.createSequentialGroup().addGap(35, 35, 35)
|
||||||
|
.addGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
|
||||||
|
.addComponent(lContraseña).addComponent(lUsuario).addComponent(lSelectUsuario))
|
||||||
|
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
|
.addGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
|
.addComponent(boxUsuario, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addComponent(fContraseña, GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE)
|
||||||
|
.addComponent(fUsuario).addComponent(bModificar, GroupLayout.DEFAULT_SIZE,
|
||||||
|
GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
|
.addGap(42, 42, 42)));
|
||||||
|
panelLayout.setVerticalGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(panelLayout.createSequentialGroup().addGap(25, 25, 25)
|
||||||
|
.addGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(boxUsuario, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
|
||||||
|
GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(lSelectUsuario))
|
||||||
|
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(fUsuario, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
|
||||||
|
GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addComponent(lUsuario))
|
||||||
|
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addGroup(panelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(lContraseña).addComponent(fContraseña, GroupLayout.PREFERRED_SIZE,
|
||||||
|
GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
|
||||||
|
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(bModificar)
|
||||||
|
.addContainerGap(29, Short.MAX_VALUE)));
|
||||||
|
|
||||||
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
|
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));
|
||||||
|
|
||||||
|
pack();
|
||||||
|
setVisible(true);
|
||||||
|
setLocationRelativeTo(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void boxUsuarioActionPerformed(ActionEvent evt) {
|
||||||
|
ControlAdmin control = new ControlAdmin();
|
||||||
|
for(int x = 0; x < control.getRowCount(); x++){
|
||||||
|
if(control.getRow(x)[0].equals(boxUsuario.getSelectedItem())){
|
||||||
|
fContraseña.setText(control.getRow(x)[1]);
|
||||||
|
fUsuario.setText(control.getRow(x)[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void bModificarActionPerformed(ActionEvent evt) {
|
||||||
|
ControlAdmin control = new ControlAdmin();
|
||||||
|
String original = control.getRow(boxUsuario.getSelectedIndex())[0]+";"+control.getRow(boxUsuario.getSelectedIndex())[1];
|
||||||
|
if(control.modificarUser(original, fUsuario.getText(), fContraseña.getText())){
|
||||||
|
new FrameAdministrador();
|
||||||
|
setVisible(false);
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void llenarBox(){
|
||||||
|
|
||||||
|
ControlAdmin control = new ControlAdmin();
|
||||||
|
boxUsuario.removeAllItems();
|
||||||
|
for(int x = 0 ; x < control.getRowCount(); x++){
|
||||||
|
boxUsuario.addItem(control.getRow(x)[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package visualV2;
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
|
||||||
public class FramePrincipal extends JFrame {
|
public class FramePrincipal extends JFrame {
|
||||||
|
|
||||||
@@ -25,10 +26,8 @@ public class FramePrincipal extends JFrame {
|
|||||||
panelCartola = new PanelCartola(usuario);
|
panelCartola = new PanelCartola(usuario);
|
||||||
panelResumen = new PanelResumen(usuario);
|
panelResumen = new PanelResumen(usuario);
|
||||||
separador = new JPanel();
|
separador = new JPanel();
|
||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
|
||||||
getContentPane().setBackground(new Color(0, 128, 128));
|
|
||||||
|
|
||||||
separador.setBackground(new Color(255, 255, 255));
|
separador.setBackground(new Color(255, 255, 255));
|
||||||
|
|
||||||
panelCard.setLayout(new CardLayout());
|
panelCard.setLayout(new CardLayout());
|
||||||
@@ -49,11 +48,12 @@ public class FramePrincipal extends JFrame {
|
|||||||
Short.MAX_VALUE)
|
Short.MAX_VALUE)
|
||||||
.addComponent(panelCard, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
|
.addComponent(panelCard, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
|
||||||
Short.MAX_VALUE)
|
Short.MAX_VALUE)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
|
||||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
layout.createSequentialGroup()
|
||||||
.addComponent(separador, javax.swing.GroupLayout.PREFERRED_SIZE,
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(separador, javax.swing.GroupLayout.PREFERRED_SIZE,
|
||||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
|
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
|
||||||
layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addComponent(panelSuperior, javax.swing.GroupLayout.PREFERRED_SIZE,
|
.addComponent(panelSuperior, javax.swing.GroupLayout.PREFERRED_SIZE,
|
||||||
@@ -70,9 +70,22 @@ public class FramePrincipal extends JFrame {
|
|||||||
| UnsupportedLookAndFeelException e) {
|
| UnsupportedLookAndFeelException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
|
setResizable(false);
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
|
setLocationRelativeTo(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void salir(ActionEvent evt) {
|
||||||
|
Object[] opciones = {"Si","No"};
|
||||||
|
if(JOptionPane.showOptionDialog(
|
||||||
|
null,"¿Esta seguro?", "Salir", JOptionPane.OK_CANCEL_OPTION,
|
||||||
|
JOptionPane.INFORMATION_MESSAGE, null,opciones,"Si")
|
||||||
|
== 0){
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toCartola() {
|
public void toCartola() {
|
||||||
|
|||||||
Reference in New Issue
Block a user