├── 1 - Hola Mundo
├── pom.xml
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── mycompany
│ │ └── mavenproject1
│ │ └── Main.java
└── target
│ ├── classes
│ ├── .netbeans_automatic_build
│ └── com
│ │ └── mycompany
│ │ └── mavenproject1
│ │ └── Main.class
│ ├── maven-status
│ └── maven-compiler-plugin
│ │ └── compile
│ │ └── default-compile
│ │ ├── createdFiles.lst
│ │ └── inputFiles.lst
│ └── test-classes
│ └── .netbeans_automatic_build
├── 2 - Input de textos
├── pom.xml
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── mycompany
│ │ └── mavenproject1
│ │ └── Main.java
└── target
│ ├── classes
│ ├── .netbeans_automatic_build
│ └── com
│ │ └── mycompany
│ │ └── mavenproject1
│ │ └── Main.class
│ ├── maven-status
│ └── maven-compiler-plugin
│ │ └── compile
│ │ └── default-compile
│ │ ├── createdFiles.lst
│ │ └── inputFiles.lst
│ └── test-classes
│ └── .netbeans_automatic_build
├── Calculadora de IMC
├── pom.xml
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── mycompany
│ │ └── sistemagestion
│ │ ├── Formulario.form
│ │ ├── Formulario.java
│ │ └── Main.java
└── target
│ ├── classes
│ ├── .netbeans_automatic_build
│ └── com
│ │ └── mycompany
│ │ └── sistemagestion
│ │ ├── Formulario$1.class
│ │ ├── Formulario$2.class
│ │ ├── Formulario.class
│ │ └── Main.class
│ ├── maven-status
│ └── maven-compiler-plugin
│ │ └── compile
│ │ └── default-compile
│ │ ├── createdFiles.lst
│ │ └── inputFiles.lst
│ └── test-classes
│ └── .netbeans_automatic_build
├── Ejercicio 1
├── pom.xml
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── mycompany
│ │ └── mavenproject1
│ │ └── Main.java
└── target
│ ├── classes
│ ├── .netbeans_automatic_build
│ └── com
│ │ └── mycompany
│ │ └── mavenproject1
│ │ └── Main.class
│ ├── maven-status
│ └── maven-compiler-plugin
│ │ └── compile
│ │ └── default-compile
│ │ ├── createdFiles.lst
│ │ └── inputFiles.lst
│ └── test-classes
│ └── .netbeans_automatic_build
├── Ejercicio 2
├── pom.xml
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── mycompany
│ │ └── mavenproject1
│ │ └── Main.java
└── target
│ ├── classes
│ ├── .netbeans_automatic_build
│ └── com
│ │ └── mycompany
│ │ └── mavenproject1
│ │ └── Main.class
│ ├── maven-status
│ └── maven-compiler-plugin
│ │ └── compile
│ │ └── default-compile
│ │ ├── createdFiles.lst
│ │ └── inputFiles.lst
│ └── test-classes
│ └── .netbeans_automatic_build
├── Ejercicio 3
├── pom.xml
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── mycompany
│ │ └── mavenproject1
│ │ └── Main.java
└── target
│ ├── classes
│ ├── .netbeans_automatic_build
│ └── com
│ │ └── mycompany
│ │ └── mavenproject1
│ │ └── Main.class
│ ├── maven-status
│ └── maven-compiler-plugin
│ │ └── compile
│ │ └── default-compile
│ │ ├── createdFiles.lst
│ │ └── inputFiles.lst
│ └── test-classes
│ └── .netbeans_automatic_build
├── Ejercicio 4
├── pom.xml
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── mycompany
│ │ └── mavenproject1
│ │ └── Main.java
└── target
│ ├── classes
│ ├── .netbeans_automatic_build
│ └── com
│ │ └── mycompany
│ │ └── mavenproject1
│ │ └── Main.class
│ ├── maven-status
│ └── maven-compiler-plugin
│ │ └── compile
│ │ └── default-compile
│ │ ├── createdFiles.lst
│ │ └── inputFiles.lst
│ └── test-classes
│ └── .netbeans_automatic_build
└── Gestion de Clientes con MySql
├── base de datos.sql
├── pom.xml
├── src
└── main
│ └── java
│ └── com
│ └── mycompany
│ └── sistemagestion
│ ├── Main.java
│ ├── dao
│ └── ClienteDao.java
│ ├── forms
│ ├── Formulario.form
│ └── Formulario.java
│ └── models
│ └── Cliente.java
└── target
├── classes
├── .netbeans_automatic_build
└── com
│ └── mycompany
│ └── sistemagestion
│ ├── Main.class
│ ├── dao
│ └── ClienteDao.class
│ ├── forms
│ ├── Formulario$1.class
│ ├── Formulario$2.class
│ ├── Formulario$3.class
│ ├── Formulario$4.class
│ ├── Formulario$5.class
│ ├── Formulario$6.class
│ ├── Formulario$7.class
│ └── Formulario.class
│ └── models
│ └── Cliente.class
├── maven-status
└── maven-compiler-plugin
│ └── compile
│ └── default-compile
│ ├── createdFiles.lst
│ └── inputFiles.lst
└── test-classes
└── .netbeans_automatic_build
/1 - Hola Mundo/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 | com.mycompany
5 | mavenproject1
6 | 1.0-SNAPSHOT
7 | jar
8 |
9 | UTF-8
10 | 1.8
11 | 1.8
12 |
13 |
--------------------------------------------------------------------------------
/1 - Hola Mundo/src/main/java/com/mycompany/mavenproject1/Main.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package com.mycompany.mavenproject1;
7 |
8 | /**
9 | *
10 | * @author lucas
11 | */
12 | public class Main {
13 |
14 | public static void main(String[] args) {
15 |
16 | String nombre = "Lucas";
17 | Integer followersInstagram = 2183;
18 | Integer followersYoutube = 5650;
19 | String frase = "Hola, mi nombre es " + nombre + ". Tengo " + (followersInstagram + followersYoutube) + " followers.";
20 | System.out.println(frase);
21 |
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/1 - Hola Mundo/target/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/1 - Hola Mundo/target/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/1 - Hola Mundo/target/classes/com/mycompany/mavenproject1/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/1 - Hola Mundo/target/classes/com/mycompany/mavenproject1/Main.class
--------------------------------------------------------------------------------
/1 - Hola Mundo/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst:
--------------------------------------------------------------------------------
1 | com\mycompany\mavenproject1\Main.class
2 |
--------------------------------------------------------------------------------
/1 - Hola Mundo/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst:
--------------------------------------------------------------------------------
1 | C:\Users\lucas\Documents\NetBeansProjects\mavenproject1\src\main\java\com\mycompany\mavenproject1\Main.java
2 |
--------------------------------------------------------------------------------
/1 - Hola Mundo/target/test-classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/1 - Hola Mundo/target/test-classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/2 - Input de textos/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 | com.mycompany
5 | mavenproject1
6 | 1.0-SNAPSHOT
7 | jar
8 |
9 | UTF-8
10 | 1.8
11 | 1.8
12 |
13 |
--------------------------------------------------------------------------------
/2 - Input de textos/src/main/java/com/mycompany/mavenproject1/Main.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package com.mycompany.mavenproject1;
7 |
8 | import java.io.BufferedReader;
9 | import java.io.IOException;
10 | import java.io.InputStreamReader;
11 |
12 | /**
13 | *
14 | * @author lucas
15 | */
16 | public class Main {
17 |
18 | public static void main(String[] args) throws IOException {
19 | InputStreamReader capturarTeclado = new InputStreamReader(System.in);
20 | BufferedReader buffer = new BufferedReader(capturarTeclado);
21 |
22 | System.out.println("Ingrese su nombre:");
23 | String nombre = buffer.readLine();
24 | System.out.println("Hola " + nombre);
25 |
26 |
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/2 - Input de textos/target/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/2 - Input de textos/target/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/2 - Input de textos/target/classes/com/mycompany/mavenproject1/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/2 - Input de textos/target/classes/com/mycompany/mavenproject1/Main.class
--------------------------------------------------------------------------------
/2 - Input de textos/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst:
--------------------------------------------------------------------------------
1 | com\mycompany\mavenproject1\Main.class
2 |
--------------------------------------------------------------------------------
/2 - Input de textos/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst:
--------------------------------------------------------------------------------
1 | C:\Users\lucas\Documents\NetBeansProjects\mavenproject1\src\main\java\com\mycompany\mavenproject1\Main.java
2 |
--------------------------------------------------------------------------------
/2 - Input de textos/target/test-classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/2 - Input de textos/target/test-classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Calculadora de IMC/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 | com.mycompany
5 | SistemaGestion
6 | 1.0-SNAPSHOT
7 | jar
8 |
9 | UTF-8
10 | 1.8
11 | 1.8
12 |
13 |
--------------------------------------------------------------------------------
/Calculadora de IMC/src/main/java/com/mycompany/sistemagestion/Formulario.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
90 |
--------------------------------------------------------------------------------
/Calculadora de IMC/src/main/java/com/mycompany/sistemagestion/Formulario.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package com.mycompany.sistemagestion;
7 |
8 | import javax.swing.JOptionPane;
9 |
10 | /**
11 | *
12 | * @author lucas
13 | */
14 | public class Formulario extends javax.swing.JFrame {
15 |
16 | /**
17 | * Creates new form Formulario
18 | */
19 | public Formulario() {
20 | initComponents();
21 | }
22 |
23 | /**
24 | * This method is called from within the constructor to initialize the form.
25 | * WARNING: Do NOT modify this code. The content of this method is always
26 | * regenerated by the Form Editor.
27 | */
28 | @SuppressWarnings("unchecked")
29 | // //GEN-BEGIN:initComponents
30 | private void initComponents() {
31 |
32 | btnGuardar = new javax.swing.JButton();
33 | txtAltura = new javax.swing.JTextField();
34 | jLabel1 = new javax.swing.JLabel();
35 | txtPeso = new javax.swing.JTextField();
36 | jLabel2 = new javax.swing.JLabel();
37 |
38 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
39 |
40 | btnGuardar.setText("Guardar");
41 | btnGuardar.addActionListener(new java.awt.event.ActionListener() {
42 | public void actionPerformed(java.awt.event.ActionEvent evt) {
43 | btnGuardarActionPerformed(evt);
44 | }
45 | });
46 |
47 | jLabel1.setText("Altura:");
48 |
49 | jLabel2.setText("Peso:");
50 |
51 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
52 | getContentPane().setLayout(layout);
53 | layout.setHorizontalGroup(
54 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
55 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
56 | .addContainerGap(62, Short.MAX_VALUE)
57 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
58 | .addGroup(layout.createSequentialGroup()
59 | .addComponent(jLabel2)
60 | .addGap(33, 33, 33)
61 | .addComponent(txtPeso, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
62 | .addGroup(layout.createSequentialGroup()
63 | .addComponent(jLabel1)
64 | .addGap(33, 33, 33)
65 | .addComponent(txtAltura, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
66 | .addComponent(btnGuardar))
67 | .addGap(79, 79, 79))
68 | );
69 | layout.setVerticalGroup(
70 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
71 | .addGroup(layout.createSequentialGroup()
72 | .addGap(68, 68, 68)
73 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
74 | .addComponent(txtAltura, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
75 | .addComponent(jLabel1))
76 | .addGap(9, 9, 9)
77 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
78 | .addComponent(txtPeso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
79 | .addComponent(jLabel2))
80 | .addGap(18, 18, 18)
81 | .addComponent(btnGuardar)
82 | .addContainerGap(192, Short.MAX_VALUE))
83 | );
84 |
85 | pack();
86 | }// //GEN-END:initComponents
87 |
88 | private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed
89 | String strAltura = this.txtAltura.getText();
90 | String strPeso = this.txtPeso.getText();
91 |
92 | Double altura = Double.parseDouble(strAltura);
93 | Double peso = Double.parseDouble(strPeso);
94 | Double imc = peso / (altura * altura);
95 |
96 | JOptionPane.showMessageDialog(rootPane, "El Indice de Masa Corporal es:" + imc);
97 | }//GEN-LAST:event_btnGuardarActionPerformed
98 |
99 | /**
100 | * @param args the command line arguments
101 | */
102 | public static void main(String args[]) {
103 | /* Set the Nimbus look and feel */
104 | //
105 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
106 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
107 | */
108 | try {
109 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
110 | if ("Nimbus".equals(info.getName())) {
111 | javax.swing.UIManager.setLookAndFeel(info.getClassName());
112 | break;
113 | }
114 | }
115 | } catch (ClassNotFoundException ex) {
116 | java.util.logging.Logger.getLogger(Formulario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
117 | } catch (InstantiationException ex) {
118 | java.util.logging.Logger.getLogger(Formulario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
119 | } catch (IllegalAccessException ex) {
120 | java.util.logging.Logger.getLogger(Formulario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
121 | } catch (javax.swing.UnsupportedLookAndFeelException ex) {
122 | java.util.logging.Logger.getLogger(Formulario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
123 | }
124 | //
125 |
126 | /* Create and display the form */
127 | java.awt.EventQueue.invokeLater(new Runnable() {
128 | public void run() {
129 | new Formulario().setVisible(true);
130 | }
131 | });
132 | }
133 |
134 | // Variables declaration - do not modify//GEN-BEGIN:variables
135 | private javax.swing.JButton btnGuardar;
136 | private javax.swing.JLabel jLabel1;
137 | private javax.swing.JLabel jLabel2;
138 | private javax.swing.JTextField txtAltura;
139 | private javax.swing.JTextField txtPeso;
140 | // End of variables declaration//GEN-END:variables
141 | }
142 |
--------------------------------------------------------------------------------
/Calculadora de IMC/src/main/java/com/mycompany/sistemagestion/Main.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package com.mycompany.sistemagestion;
7 |
8 | /**
9 | *
10 | * @author lucas
11 | */
12 | public class Main {
13 |
14 | public static void main(String[] args) {
15 | Formulario ventana = new Formulario();
16 | ventana.show();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Calculadora de IMC/target/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Calculadora de IMC/target/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Calculadora de IMC/target/classes/com/mycompany/sistemagestion/Formulario$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Calculadora de IMC/target/classes/com/mycompany/sistemagestion/Formulario$1.class
--------------------------------------------------------------------------------
/Calculadora de IMC/target/classes/com/mycompany/sistemagestion/Formulario$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Calculadora de IMC/target/classes/com/mycompany/sistemagestion/Formulario$2.class
--------------------------------------------------------------------------------
/Calculadora de IMC/target/classes/com/mycompany/sistemagestion/Formulario.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Calculadora de IMC/target/classes/com/mycompany/sistemagestion/Formulario.class
--------------------------------------------------------------------------------
/Calculadora de IMC/target/classes/com/mycompany/sistemagestion/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Calculadora de IMC/target/classes/com/mycompany/sistemagestion/Main.class
--------------------------------------------------------------------------------
/Calculadora de IMC/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst:
--------------------------------------------------------------------------------
1 | com\mycompany\sistemagestion\Formulario.class
2 | com\mycompany\sistemagestion\Main.class
3 | com\mycompany\sistemagestion\Formulario$1.class
4 |
--------------------------------------------------------------------------------
/Calculadora de IMC/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst:
--------------------------------------------------------------------------------
1 | C:\Users\lucas\Documents\NetBeansProjects\mavenproject2\SistemaGestion\src\main\java\com\mycompany\sistemagestion\Main.java
2 | C:\Users\lucas\Documents\NetBeansProjects\mavenproject2\SistemaGestion\src\main\java\com\mycompany\sistemagestion\Formulario.java
3 |
--------------------------------------------------------------------------------
/Calculadora de IMC/target/test-classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Calculadora de IMC/target/test-classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Ejercicio 1/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 | com.mycompany
5 | mavenproject1
6 | 1.0-SNAPSHOT
7 | jar
8 |
9 | UTF-8
10 | 1.8
11 | 1.8
12 |
13 |
--------------------------------------------------------------------------------
/Ejercicio 1/src/main/java/com/mycompany/mavenproject1/Main.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package com.mycompany.mavenproject1;
7 |
8 | import java.io.BufferedReader;
9 | import java.io.IOException;
10 | import java.io.InputStreamReader;
11 |
12 | /**
13 | *
14 | * @author lucas
15 | */
16 | public class Main {
17 |
18 | public static void main(String[] args) throws IOException {
19 | // Con este codigo pedimos un número
20 | System.out.println("Ingrese el primer número:");
21 | Integer numero1 = cargarNumero();
22 |
23 | System.out.println("Ingrese el segundo número:");
24 | Integer numero2 = cargarNumero();
25 |
26 | System.out.println("Ingrese el tercer número:");
27 | Integer numero3 = cargarNumero();
28 |
29 | // Con este codigo calculamos el numero mayor y el nnumero menor
30 | calcularNumeroMayor(numero1, numero2, numero3);
31 | calcularNumeroMenor(numero1, numero2, numero3);
32 | }
33 |
34 | /**
35 | *
36 | * @return
37 | */
38 | private static Integer cargarNumero() {
39 | InputStreamReader capturarTeclado = new InputStreamReader(System.in);
40 | BufferedReader buffer = new BufferedReader(capturarTeclado);
41 | String strNumero = buffer.readLine();
42 | Integer numero = Integer.parseInt(strNumero);
43 | return numero;
44 | }
45 |
46 | /**
47 | * Esta funcion sirve para mostrar el calculo de un numero mayor
48 | * @param numero1 Es el primer numero
49 | * @param numero2 Es el segundo numero
50 | * @param numero3 Es el tercer numero
51 | */
52 | private static void calcularNumeroMayor(Integer numero1, Integer numero2, Integer numero3) {
53 |
54 | Integer numeroMayor = numero1;
55 |
56 | if (numero2 > numeroMayor) {
57 | numeroMayor = numero2;
58 | }
59 | if (numero3 > numeroMayor) {
60 | numeroMayor = numero3;
61 | }
62 |
63 | System.out.println("El número mayor es: " + numeroMayor);
64 | }
65 |
66 |
67 | private static void calcularNumeroMenor(Integer numero1, Integer numero2, Integer numero3) {
68 | Integer numeroMenor = numero1;
69 |
70 | if (numero2 < numeroMenor) {
71 | numeroMenor = numero2;
72 | }
73 | if (numero3 < numeroMenor) {
74 | numeroMenor = numero3;
75 | }
76 |
77 | System.out.println("El número menor es: " + numeroMenor);
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/Ejercicio 1/target/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Ejercicio 1/target/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Ejercicio 1/target/classes/com/mycompany/mavenproject1/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Ejercicio 1/target/classes/com/mycompany/mavenproject1/Main.class
--------------------------------------------------------------------------------
/Ejercicio 1/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst:
--------------------------------------------------------------------------------
1 | com\mycompany\mavenproject1\Main.class
2 |
--------------------------------------------------------------------------------
/Ejercicio 1/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst:
--------------------------------------------------------------------------------
1 | C:\Users\lucas\Documents\NetBeansProjects\mavenproject1\src\main\java\com\mycompany\mavenproject1\Main.java
2 |
--------------------------------------------------------------------------------
/Ejercicio 1/target/test-classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Ejercicio 1/target/test-classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Ejercicio 2/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 | com.mycompany
5 | mavenproject1
6 | 1.0-SNAPSHOT
7 | jar
8 |
9 | UTF-8
10 | 1.8
11 | 1.8
12 |
13 |
--------------------------------------------------------------------------------
/Ejercicio 2/src/main/java/com/mycompany/mavenproject1/Main.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package com.mycompany.mavenproject1;
7 |
8 | import java.io.BufferedReader;
9 | import java.io.IOException;
10 | import java.io.InputStreamReader;
11 |
12 | /**
13 | *
14 | * @author lucas
15 | */
16 | public class Main {
17 |
18 | public static void main(String[] args) throws IOException {
19 | // Con este codigo pedimos un número
20 | System.out.println("Ingrese el primer número:");
21 | Integer numero1 = cargarNumero();
22 |
23 | System.out.println("Ingrese el segundo número:");
24 | Integer numero2 = cargarNumero();
25 |
26 | System.out.println("Ingrese el tercer número:");
27 | Integer numero3 = cargarNumero();
28 |
29 | Integer sumatoria = numero1 + numero2 + numero3;
30 | Double numeroPromedio = Double.valueOf(sumatoria) / 3;
31 | System.out.println("El número promedio es: " + numeroPromedio);
32 | }
33 |
34 | /**
35 | *
36 | * @return
37 | */
38 | private static Integer cargarNumero() {
39 | InputStreamReader capturarTeclado = new InputStreamReader(System.in);
40 | BufferedReader buffer = new BufferedReader(capturarTeclado);
41 | String strNumero = buffer.readLine();
42 | Integer numero = Integer.parseInt(strNumero);
43 | return numero;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/Ejercicio 2/target/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Ejercicio 2/target/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Ejercicio 2/target/classes/com/mycompany/mavenproject1/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Ejercicio 2/target/classes/com/mycompany/mavenproject1/Main.class
--------------------------------------------------------------------------------
/Ejercicio 2/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst:
--------------------------------------------------------------------------------
1 | com\mycompany\mavenproject1\Main.class
2 |
--------------------------------------------------------------------------------
/Ejercicio 2/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst:
--------------------------------------------------------------------------------
1 | C:\Users\lucas\Documents\NetBeansProjects\mavenproject1\src\main\java\com\mycompany\mavenproject1\Main.java
2 |
--------------------------------------------------------------------------------
/Ejercicio 2/target/test-classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Ejercicio 2/target/test-classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Ejercicio 3/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 | com.mycompany
5 | mavenproject1
6 | 1.0-SNAPSHOT
7 | jar
8 |
9 | UTF-8
10 | 1.8
11 | 1.8
12 |
13 |
--------------------------------------------------------------------------------
/Ejercicio 3/src/main/java/com/mycompany/mavenproject1/Main.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package com.mycompany.mavenproject1;
7 |
8 | import java.io.BufferedReader;
9 | import java.io.IOException;
10 | import java.io.InputStreamReader;
11 |
12 | /**
13 | *
14 | * @author lucas
15 | */
16 | public class Main {
17 |
18 | public static void main(String[] args) throws IOException {
19 | // Con este codigo pedimos un número
20 | System.out.println("Ingrese el primer número:");
21 | Double numero = Double.valueOf(cargarNumero());
22 |
23 | //Boolean esPar = (numero % 2) == 0;
24 |
25 | Boolean esPar = (numero / 2) == Math.round(numero / 2);
26 |
27 | if (esPar) {
28 | System.out.println("El número es par");
29 | } else {
30 | System.out.println("El número es impar");
31 | }
32 |
33 | }
34 |
35 | /**
36 | *
37 | * @return
38 | */
39 | private static Integer cargarNumero() throws IOException {
40 | InputStreamReader capturarTeclado = new InputStreamReader(System.in);
41 | BufferedReader buffer = new BufferedReader(capturarTeclado);
42 | String strNumero = buffer.readLine();
43 | Integer numero = Integer.parseInt(strNumero);
44 | return numero;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/Ejercicio 3/target/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Ejercicio 3/target/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Ejercicio 3/target/classes/com/mycompany/mavenproject1/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Ejercicio 3/target/classes/com/mycompany/mavenproject1/Main.class
--------------------------------------------------------------------------------
/Ejercicio 3/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst:
--------------------------------------------------------------------------------
1 | com\mycompany\mavenproject1\Main.class
2 |
--------------------------------------------------------------------------------
/Ejercicio 3/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst:
--------------------------------------------------------------------------------
1 | C:\Users\lucas\Documents\NetBeansProjects\mavenproject1\src\main\java\com\mycompany\mavenproject1\Main.java
2 |
--------------------------------------------------------------------------------
/Ejercicio 3/target/test-classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Ejercicio 3/target/test-classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Ejercicio 4/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 | com.mycompany
5 | mavenproject1
6 | 1.0-SNAPSHOT
7 | jar
8 |
9 | UTF-8
10 | 1.8
11 | 1.8
12 |
13 |
--------------------------------------------------------------------------------
/Ejercicio 4/src/main/java/com/mycompany/mavenproject1/Main.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package com.mycompany.mavenproject1;
7 |
8 | import java.io.BufferedReader;
9 | import java.io.IOException;
10 | import java.io.InputStreamReader;
11 |
12 | /**
13 | *
14 | * @author lucas
15 | */
16 | public class Main {
17 |
18 | public static void main(String[] args) throws IOException {
19 | String resultado = "";
20 |
21 | int contador = 0;
22 | int numero = 1;
23 | while(contador < 100) {
24 | if (esPrimo(numero)) {
25 | resultado += numero + ", ";
26 | contador++;
27 | }
28 | numero++;
29 | }
30 | System.out.println("Los primeros 100 números primos son: " + resultado);
31 | }
32 |
33 | private static Boolean esPrimo(Integer numero) {
34 | Boolean esUnNumeroPrimo = true;
35 |
36 | for (int i = 2; i < numero; i++) {
37 |
38 | if (numero % i == 0) {
39 | esUnNumeroPrimo = false;
40 | }
41 | }
42 | return esUnNumeroPrimo;
43 | }
44 |
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/Ejercicio 4/target/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Ejercicio 4/target/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Ejercicio 4/target/classes/com/mycompany/mavenproject1/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Ejercicio 4/target/classes/com/mycompany/mavenproject1/Main.class
--------------------------------------------------------------------------------
/Ejercicio 4/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst:
--------------------------------------------------------------------------------
1 | com\mycompany\mavenproject1\Main.class
2 |
--------------------------------------------------------------------------------
/Ejercicio 4/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst:
--------------------------------------------------------------------------------
1 | C:\Users\lucas\Documents\NetBeansProjects\mavenproject1\src\main\java\com\mycompany\mavenproject1\Main.java
2 |
--------------------------------------------------------------------------------
/Ejercicio 4/target/test-classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Ejercicio 4/target/test-classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/base de datos.sql:
--------------------------------------------------------------------------------
1 | -- phpMyAdmin SQL Dump
2 | -- version 5.1.0
3 | -- https://www.phpmyadmin.net/
4 | --
5 | -- Host: 127.0.0.1
6 | -- Generation Time: May 25, 2021 at 06:05 PM
7 | -- Server version: 10.4.18-MariaDB
8 | -- PHP Version: 7.3.27
9 |
10 | SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
11 | START TRANSACTION;
12 | SET time_zone = "+00:00";
13 |
14 |
15 | /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
16 | /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
17 | /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
18 | /*!40101 SET NAMES utf8mb4 */;
19 |
20 | --
21 | -- Database: `java`
22 | --
23 |
24 | -- --------------------------------------------------------
25 |
26 | --
27 | -- Table structure for table `clientes`
28 | --
29 |
30 | CREATE TABLE `clientes` (
31 | `id` int(11) NOT NULL,
32 | `nombre` varchar(50) COLLATE utf8_bin NOT NULL,
33 | `apellido` varchar(50) COLLATE utf8_bin NOT NULL,
34 | `telefono` varchar(50) COLLATE utf8_bin NOT NULL,
35 | `email` varchar(254) COLLATE utf8_bin NOT NULL
36 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
37 |
38 | --
39 | -- Dumping data for table `clientes`
40 | --
41 |
42 | INSERT INTO `clientes` (`id`, `nombre`, `apellido`, `telefono`, `email`) VALUES
43 | (1, 'Mario', 'Moy', '666666', 'asdasdasd@asd.comx'),
44 | (3, 'Pedro', 'Perez', '234234', 'Perez'),
45 | (5, 'Julieta', 'Sanchez', '244234234234', 'juliSanc@gmail.com');
46 |
47 | --
48 | -- Indexes for dumped tables
49 | --
50 |
51 | --
52 | -- Indexes for table `clientes`
53 | --
54 | ALTER TABLE `clientes`
55 | ADD PRIMARY KEY (`id`);
56 |
57 | --
58 | -- AUTO_INCREMENT for dumped tables
59 | --
60 |
61 | --
62 | -- AUTO_INCREMENT for table `clientes`
63 | --
64 | ALTER TABLE `clientes`
65 | MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
66 | COMMIT;
67 |
68 | /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
69 | /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
70 | /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
71 |
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 | com.mycompany
5 | SistemaGestion
6 | 1.0-SNAPSHOT
7 | jar
8 |
9 | UTF-8
10 | 1.8
11 | 1.8
12 |
13 |
14 |
15 |
16 | mysql
17 | mysql-connector-java
18 | 5.1.39
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/src/main/java/com/mycompany/sistemagestion/Main.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package com.mycompany.sistemagestion;
7 |
8 | import com.mycompany.sistemagestion.forms.Formulario;
9 |
10 | /**
11 | *
12 | * @author lucas
13 | */
14 | public class Main {
15 |
16 | public static void main(String[] args) {
17 | Formulario ventana = new Formulario();
18 | ventana.show();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/src/main/java/com/mycompany/sistemagestion/dao/ClienteDao.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package com.mycompany.sistemagestion.dao;
7 |
8 | import com.mycompany.sistemagestion.models.Cliente;
9 | import com.mysql.jdbc.StringUtils;
10 | import java.sql.Connection;
11 | import java.sql.DriverManager;
12 | import java.sql.ResultSet;
13 | import java.sql.SQLException;
14 | import java.sql.Statement;
15 | import java.util.ArrayList;
16 | import java.util.List;
17 | import java.util.logging.Level;
18 | import java.util.logging.Logger;
19 |
20 | /**
21 | *
22 | * @author lucas
23 | */
24 | public class ClienteDao {
25 |
26 | public Connection conectar() {
27 | String baseDeDatos = "java";
28 | String usuario = "root";
29 | String password = "";
30 | String host = "localhost";
31 | String puerto = "3306";
32 | String driver = "com.mysql.jdbc.Driver";
33 | String conexionUrl = "jdbc:mysql://" + host + ":" + puerto + "/" + baseDeDatos + "?useSSL=false";
34 |
35 | Connection conexion = null;
36 |
37 | try {
38 | Class.forName(driver);
39 | conexion = DriverManager.getConnection(conexionUrl, usuario, password);
40 |
41 | } catch (Exception ex) {
42 | Logger.getLogger(ClienteDao.class.getName()).log(Level.SEVERE, null, ex);
43 | }
44 | return conexion;
45 | }
46 |
47 | public void agregar(Cliente cliente) {
48 |
49 | try {
50 | Connection conexion = conectar();
51 | String sql = "INSERT INTO `clientes` (`id`, `nombre`, `apellido`, `telefono`, `email`) VALUES (NULL, '"
52 | + cliente.getNombre() + "', '"
53 | + cliente.getApellido() + "', '" + cliente.getTelefono() + "', '" + cliente.getEmail() + "');";
54 |
55 |
56 | Statement statement = conexion.createStatement();
57 | statement.execute(sql);
58 | } catch (Exception ex) {
59 | Logger.getLogger(ClienteDao.class.getName()).log(Level.SEVERE, null, ex);
60 | }
61 |
62 | }
63 |
64 | public void actualizar(Cliente cliente) {
65 |
66 | try {
67 | Connection conexion = conectar();
68 | String sql = "UPDATE `clientes` SET `nombre` = '" + cliente.getNombre()
69 | + "', `apellido` = '" + cliente.getApellido()
70 | + "', `telefono` = '"+ cliente.getTelefono()
71 | + "', `email` = '"+cliente.getEmail()
72 | +"' WHERE `clientes`.`id` = "+cliente.getId()+";";
73 |
74 | Statement statement = conexion.createStatement();
75 | statement.execute(sql);
76 | } catch (Exception ex) {
77 | Logger.getLogger(ClienteDao.class.getName()).log(Level.SEVERE, null, ex);
78 | }
79 |
80 | }
81 |
82 | public List listar() {
83 | List listado = new ArrayList<>();
84 |
85 | try {
86 | Connection conexion = conectar();
87 | String sql = "SELECT * FROM `clientes`;";
88 |
89 | Statement statement = conexion.createStatement();
90 | ResultSet resultado = statement.executeQuery(sql);
91 |
92 | while(resultado.next()) {
93 | Cliente cliente = new Cliente();
94 | cliente.setId(resultado.getString("id"));
95 | cliente.setNombre(resultado.getString("nombre"));
96 | cliente.setApellido(resultado.getString("apellido"));
97 | cliente.setTelefono(resultado.getString("telefono"));
98 | cliente.setEmail(resultado.getString("email"));
99 | listado.add(cliente);
100 | }
101 |
102 | } catch (Exception ex) {
103 | Logger.getLogger(ClienteDao.class.getName()).log(Level.SEVERE, null, ex);
104 | }
105 |
106 | return listado;
107 | }
108 |
109 | public void eliminar(String id) {
110 | try {
111 | Connection conexion = conectar();
112 | String sql = "DELETE FROM `clientes` WHERE `clientes`.`id` = " + id;
113 |
114 | Statement statement = conexion.createStatement();
115 | statement.execute(sql);
116 | } catch (Exception ex) {
117 | Logger.getLogger(ClienteDao.class.getName()).log(Level.SEVERE, null, ex);
118 | }
119 |
120 | }
121 |
122 | public void guardar(Cliente cliente) {
123 | if (StringUtils.isEmptyOrWhitespaceOnly(cliente.getId())) {
124 | agregar(cliente);
125 | } else {
126 | actualizar(cliente);
127 | }
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/src/main/java/com/mycompany/sistemagestion/forms/Formulario.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
224 |
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/src/main/java/com/mycompany/sistemagestion/forms/Formulario.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package com.mycompany.sistemagestion.forms;
7 |
8 | import com.mycompany.sistemagestion.dao.ClienteDao;
9 | import com.mycompany.sistemagestion.models.Cliente;
10 | import com.mysql.jdbc.StringUtils;
11 | import java.util.ArrayList;
12 | import java.util.List;
13 | import javax.swing.DefaultListModel;
14 | import javax.swing.JOptionPane;
15 |
16 | /**
17 | *
18 | * @author lucas
19 | */
20 | public class Formulario extends javax.swing.JFrame {
21 |
22 | private List lista = new ArrayList<>();
23 |
24 | /**
25 | * Creates new form Formulario
26 | */
27 | public Formulario() {
28 | initComponents();
29 | }
30 |
31 | /**
32 | * This method is called from within the constructor to initialize the form.
33 | * WARNING: Do NOT modify this code. The content of this method is always
34 | * regenerated by the Form Editor.
35 | */
36 | @SuppressWarnings("unchecked")
37 | // //GEN-BEGIN:initComponents
38 | private void initComponents() {
39 |
40 | btnGuardar = new javax.swing.JButton();
41 | txtNombre = new javax.swing.JTextField();
42 | jLabel1 = new javax.swing.JLabel();
43 | jScrollPane1 = new javax.swing.JScrollPane();
44 | listClientes = new javax.swing.JList<>();
45 | btnEliminar = new javax.swing.JButton();
46 | jLabel2 = new javax.swing.JLabel();
47 | txtApellido = new javax.swing.JTextField();
48 | jLabel3 = new javax.swing.JLabel();
49 | txtEmail = new javax.swing.JTextField();
50 | jLabel4 = new javax.swing.JLabel();
51 | txtTelefono = new javax.swing.JTextField();
52 | btnEditar = new javax.swing.JButton();
53 | jLabel5 = new javax.swing.JLabel();
54 | lblId = new javax.swing.JLabel();
55 | btnNuevo = new javax.swing.JButton();
56 |
57 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
58 | addContainerListener(new java.awt.event.ContainerAdapter() {
59 | public void componentAdded(java.awt.event.ContainerEvent evt) {
60 | formComponentAdded(evt);
61 | }
62 | });
63 | addComponentListener(new java.awt.event.ComponentAdapter() {
64 | public void componentShown(java.awt.event.ComponentEvent evt) {
65 | formComponentShown(evt);
66 | }
67 | });
68 |
69 | btnGuardar.setText("Guardar");
70 | btnGuardar.addActionListener(new java.awt.event.ActionListener() {
71 | public void actionPerformed(java.awt.event.ActionEvent evt) {
72 | btnGuardarActionPerformed(evt);
73 | }
74 | });
75 |
76 | jLabel1.setText("Nombre:");
77 |
78 | jScrollPane1.setViewportView(listClientes);
79 |
80 | btnEliminar.setText("Eliminar");
81 | btnEliminar.addActionListener(new java.awt.event.ActionListener() {
82 | public void actionPerformed(java.awt.event.ActionEvent evt) {
83 | btnEliminarActionPerformed(evt);
84 | }
85 | });
86 |
87 | jLabel2.setText("Apellido:");
88 |
89 | jLabel3.setText("Email:");
90 |
91 | jLabel4.setText("Teléfono:");
92 |
93 | btnEditar.setText("Editar");
94 | btnEditar.addActionListener(new java.awt.event.ActionListener() {
95 | public void actionPerformed(java.awt.event.ActionEvent evt) {
96 | btnEditarActionPerformed(evt);
97 | }
98 | });
99 |
100 | jLabel5.setText("Id:");
101 |
102 | btnNuevo.setText("Nuevo");
103 | btnNuevo.addActionListener(new java.awt.event.ActionListener() {
104 | public void actionPerformed(java.awt.event.ActionEvent evt) {
105 | btnNuevoActionPerformed(evt);
106 | }
107 | });
108 |
109 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
110 | getContentPane().setLayout(layout);
111 | layout.setHorizontalGroup(
112 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
113 | .addGroup(layout.createSequentialGroup()
114 | .addContainerGap()
115 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
116 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
117 | .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)
118 | .addGap(18, 18, 18)
119 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
120 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
121 | .addComponent(btnGuardar)
122 | .addGroup(layout.createSequentialGroup()
123 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
124 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
125 | .addComponent(jLabel1)
126 | .addGap(33, 33, 33))
127 | .addGroup(layout.createSequentialGroup()
128 | .addComponent(jLabel5)
129 | .addGap(60, 60, 60)))
130 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
131 | .addComponent(lblId)
132 | .addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))))
133 | .addGroup(layout.createSequentialGroup()
134 | .addComponent(jLabel4)
135 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
136 | .addComponent(txtTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
137 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
138 | .addComponent(jLabel3)
139 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
140 | .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
141 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
142 | .addComponent(jLabel2)
143 | .addGap(33, 33, 33)
144 | .addComponent(txtApellido, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)))
145 | .addGap(84, 84, 84))
146 | .addGroup(layout.createSequentialGroup()
147 | .addComponent(btnNuevo)
148 | .addGap(7, 7, 7)
149 | .addComponent(btnEditar)
150 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
151 | .addComponent(btnEliminar)
152 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
153 | );
154 | layout.setVerticalGroup(
155 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
156 | .addGroup(layout.createSequentialGroup()
157 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
158 | .addGroup(layout.createSequentialGroup()
159 | .addGap(48, 48, 48)
160 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
161 | .addComponent(jLabel5)
162 | .addComponent(lblId))
163 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
164 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
165 | .addComponent(txtNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
166 | .addComponent(jLabel1))
167 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
168 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
169 | .addComponent(txtApellido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
170 | .addComponent(jLabel2))
171 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
172 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
173 | .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
174 | .addComponent(jLabel3))
175 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
176 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
177 | .addComponent(txtTelefono, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
178 | .addComponent(jLabel4))
179 | .addGap(25, 25, 25)
180 | .addComponent(btnGuardar))
181 | .addGroup(layout.createSequentialGroup()
182 | .addContainerGap()
183 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 236, javax.swing.GroupLayout.PREFERRED_SIZE)))
184 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
185 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
186 | .addComponent(btnEliminar)
187 | .addComponent(btnEditar)
188 | .addComponent(btnNuevo))
189 | .addContainerGap(74, Short.MAX_VALUE))
190 | );
191 |
192 | pack();
193 | }// //GEN-END:initComponents
194 |
195 |
196 | private void btnGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarActionPerformed
197 |
198 | Cliente cliente = new Cliente();
199 | cliente.setNombre(this.txtNombre.getText());
200 | cliente.setApellido(this.txtApellido.getText());
201 | cliente.setTelefono(this.txtTelefono.getText());
202 | cliente.setEmail(this.txtEmail.getText());
203 |
204 | if (!StringUtils.isEmptyOrWhitespaceOnly(lblId.getText())) {
205 | cliente.setId(lblId.getText());
206 | }
207 |
208 | ClienteDao dao = new ClienteDao();
209 | dao.guardar(cliente);
210 |
211 | actualizarLista();
212 | JOptionPane.showMessageDialog(rootPane, "El cliente se guardó correctamente");
213 | limpiarCajasDeTexto();
214 | }//GEN-LAST:event_btnGuardarActionPerformed
215 |
216 | private void limpiarCajasDeTexto() {
217 | this.txtApellido.setText("");
218 | this.txtEmail.setText("");
219 | this.txtTelefono.setText("");
220 | this.txtNombre.setText("");
221 | this.lblId.setText("");
222 | }
223 |
224 | private void btnEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEliminarActionPerformed
225 | int indice = this.listClientes.getSelectedIndex();
226 | Cliente cliente = lista.get(indice);
227 | ClienteDao dao = new ClienteDao();
228 | dao.eliminar(cliente.getId());
229 | actualizarLista();
230 | JOptionPane.showMessageDialog(rootPane, "Se eliminó correctamente.");
231 | }//GEN-LAST:event_btnEliminarActionPerformed
232 |
233 | private void formComponentAdded(java.awt.event.ContainerEvent evt) {//GEN-FIRST:event_formComponentAdded
234 | actualizarLista();
235 | }//GEN-LAST:event_formComponentAdded
236 |
237 | private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
238 | actualizarLista();
239 | }//GEN-LAST:event_formComponentShown
240 |
241 | private void btnEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEditarActionPerformed
242 | int indice = this.listClientes.getSelectedIndex();
243 | Cliente cliente = lista.get(indice);
244 |
245 | this.txtNombre.setText(cliente.getNombre());
246 | this.txtApellido.setText(cliente.getApellido());
247 | this.txtEmail.setText(cliente.getEmail());
248 | this.txtTelefono.setText(cliente.getTelefono());
249 | this.lblId.setText(cliente.getId());
250 | }//GEN-LAST:event_btnEditarActionPerformed
251 |
252 | private void btnNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoActionPerformed
253 | limpiarCajasDeTexto();
254 | }//GEN-LAST:event_btnNuevoActionPerformed
255 |
256 | private void actualizarLista() {
257 | ClienteDao dao = new ClienteDao();
258 | lista = dao.listar();
259 |
260 | DefaultListModel datos = new DefaultListModel();
261 | for (int i = 0; i < lista.size(); i++) {
262 | Cliente cliente = lista.get(i);
263 | datos.addElement(cliente.getNombreCompleto());
264 | }
265 | this.listClientes.setModel(datos);
266 | }
267 |
268 | /**
269 | * @param args the command line arguments
270 | */
271 | public static void main(String args[]) {
272 | /* Set the Nimbus look and feel */
273 | //
274 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
275 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
276 | */
277 | try {
278 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
279 | if ("Nimbus".equals(info.getName())) {
280 | javax.swing.UIManager.setLookAndFeel(info.getClassName());
281 | break;
282 | }
283 | }
284 | } catch (ClassNotFoundException ex) {
285 | java.util.logging.Logger.getLogger(Formulario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
286 | } catch (InstantiationException ex) {
287 | java.util.logging.Logger.getLogger(Formulario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
288 | } catch (IllegalAccessException ex) {
289 | java.util.logging.Logger.getLogger(Formulario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
290 | } catch (javax.swing.UnsupportedLookAndFeelException ex) {
291 | java.util.logging.Logger.getLogger(Formulario.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
292 | }
293 | //
294 |
295 | /* Create and display the form */
296 | java.awt.EventQueue.invokeLater(new Runnable() {
297 | public void run() {
298 | new Formulario().setVisible(true);
299 | }
300 | });
301 | }
302 |
303 | // Variables declaration - do not modify//GEN-BEGIN:variables
304 | private javax.swing.JButton btnEditar;
305 | private javax.swing.JButton btnEliminar;
306 | private javax.swing.JButton btnGuardar;
307 | private javax.swing.JButton btnNuevo;
308 | private javax.swing.JLabel jLabel1;
309 | private javax.swing.JLabel jLabel2;
310 | private javax.swing.JLabel jLabel3;
311 | private javax.swing.JLabel jLabel4;
312 | private javax.swing.JLabel jLabel5;
313 | private javax.swing.JScrollPane jScrollPane1;
314 | private javax.swing.JLabel lblId;
315 | private javax.swing.JList listClientes;
316 | private javax.swing.JTextField txtApellido;
317 | private javax.swing.JTextField txtEmail;
318 | private javax.swing.JTextField txtNombre;
319 | private javax.swing.JTextField txtTelefono;
320 | // End of variables declaration//GEN-END:variables
321 | }
322 |
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/src/main/java/com/mycompany/sistemagestion/models/Cliente.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package com.mycompany.sistemagestion.models;
7 |
8 | /**
9 | *
10 | * @author lucas
11 | */
12 | public class Cliente {
13 |
14 | private String id;
15 | private String nombre;
16 | private String apellido;
17 | private String email;
18 | private String telefono;
19 |
20 | public String getId() {
21 | return id;
22 | }
23 |
24 | public void setId(String id) {
25 | this.id = id;
26 | }
27 |
28 | public String getNombre() {
29 | return nombre;
30 | }
31 |
32 | public void setNombre(String nombre) {
33 | this.nombre = nombre;
34 | }
35 |
36 | public String getApellido() {
37 | return apellido;
38 | }
39 |
40 | public void setApellido(String apellido) {
41 | this.apellido = apellido;
42 | }
43 |
44 | public String getEmail() {
45 | return email;
46 | }
47 |
48 | public void setEmail(String email) {
49 | this.email = email;
50 | }
51 |
52 | public String getTelefono() {
53 | return telefono;
54 | }
55 |
56 | public void setTelefono(String telefono) {
57 | this.telefono = telefono;
58 | }
59 |
60 | public String getNombreCompleto() {
61 | return nombre + " " + apellido;
62 | }
63 |
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/target/classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Gestion de Clientes con MySql/target/classes/.netbeans_automatic_build
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/Main.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/Main.class
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/dao/ClienteDao.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/dao/ClienteDao.class
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario$1.class
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario$2.class
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario$3.class
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario$4.class
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario$5.class
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario$6.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario$6.class
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario$7.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario$7.class
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/forms/Formulario.class
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/models/Cliente.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Gestion de Clientes con MySql/target/classes/com/mycompany/sistemagestion/models/Cliente.class
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst:
--------------------------------------------------------------------------------
1 | com\mycompany\sistemagestion\Formulario.class
2 | com\mycompany\sistemagestion\Main.class
3 | com\mycompany\sistemagestion\Formulario$1.class
4 |
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst:
--------------------------------------------------------------------------------
1 | C:\Users\lucas\Documents\NetBeansProjects\mavenproject2\SistemaGestion\src\main\java\com\mycompany\sistemagestion\Main.java
2 | C:\Users\lucas\Documents\NetBeansProjects\mavenproject2\SistemaGestion\src\main\java\com\mycompany\sistemagestion\Formulario.java
3 |
--------------------------------------------------------------------------------
/Gestion de Clientes con MySql/target/test-classes/.netbeans_automatic_build:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lucasmoy-dev/Curso-de-Java/c7a18d8250fd7fefc47b98dbb740938432b681d2/Gestion de Clientes con MySql/target/test-classes/.netbeans_automatic_build
--------------------------------------------------------------------------------