This commit is contained in:
edgar.juarez 2024-03-04 08:47:47 -06:00
parent 0afe1a02f2
commit 905d5c4486
17 changed files with 260 additions and 80 deletions

View File

@ -6,6 +6,19 @@
<synchronize>true</synchronize> <synchronize>true</synchronize>
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver> <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://db4free.net:3306/basecursos</jdbc-url> <jdbc-url>jdbc:mysql://db4free.net:3306/basecursos</jdbc-url>
<jdbc-additional-properties>
<property name="com.intellij.clouds.kubernetes.db.host.port" />
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
<property name="com.intellij.clouds.kubernetes.db.resource.type" value="Deployment" />
<property name="com.intellij.clouds.kubernetes.db.container.port" />
</jdbc-additional-properties>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
<data-source source="LOCAL" name="@localhost" uuid="5c6ea976-6ab8-4264-9c10-a818b02ab966">
<driver-ref>mysql.8</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://localhost:3306</jdbc-url>
<jdbc-additional-properties> <jdbc-additional-properties>
<property name="com.intellij.clouds.kubernetes.db.host.port" /> <property name="com.intellij.clouds.kubernetes.db.host.port" />
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" /> <property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />

View File

@ -2,14 +2,11 @@
<project version="4"> <project version="4">
<component name="Palette2"> <component name="Palette2">
<group name="Swing"> <group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false"> <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item> </item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false"> <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item> </item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true"> <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
@ -26,6 +23,9 @@
<property name="text" value="RadioButton" /> <property name="text" value="RadioButton" />
</initial-values> </initial-values>
</item> </item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false"> <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values> <initial-values>
@ -38,11 +38,6 @@
<property name="text" value="Label" /> <property name="text" value="Label" />
</initial-values> </initial-values>
</item> </item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true"> <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" /> <preferred-size width="150" height="-1" />
@ -53,6 +48,11 @@
<preferred-size width="150" height="-1" /> <preferred-size width="150" height="-1" />
</default-constraints> </default-constraints>
</item> </item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true"> <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" /> <preferred-size width="150" height="50" />

13
ConexionBD.java Normal file
View File

@ -0,0 +1,13 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConexionBD {
private static final String URL = "jdbc:mysql://db4free.net:3306/basecursos";
private static final String USERNAME = "edgarivanjc";
private static final String PASSWORD = "edgarivanJC12";
public static Connection getConnection() throws SQLException {
return DriverManager.getConnection(URL, USERNAME, PASSWORD);
}
}

View File

@ -1,13 +1,13 @@
import java.sql.*; import java.sql.*;
public class DatabaseManager { public class DatabaseManager {
private static final String URL = "jdbc:mysql://db4free.net:3306/basecursos"; // private static final String URL = "jdbc:mysql://db4free.net:3306/basecursos";
private static final String USERNAME = "edgarivanjc"; // private static final String USERNAME = "edgarivanjc";
private static final String PASSWORD = "edgarivanJC12"; // private static final String PASSWORD = "edgarivanJC12";
public static User getAuthenticatedUser(String nombre, String contrasena) { public static User getAuthenticatedUser(String nombre, String contrasena) {
User user = null; User user = null;
try (Connection conexion = DriverManager.getConnection(URL, USERNAME, PASSWORD)) { try (Connection conexion = ConexionBD.getConnection()){
String consulta = "SELECT * FROM usuarios WHERE nombre = ? AND contrasena = ?"; String consulta = "SELECT * FROM usuarios WHERE nombre = ? AND contrasena = ?";
try (PreparedStatement statement = conexion.prepareStatement(consulta)) { try (PreparedStatement statement = conexion.prepareStatement(consulta)) {
statement.setString(1, nombre); statement.setString(1, nombre);
@ -27,4 +27,8 @@ public class DatabaseManager {
} }
return user; return user;
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -2,14 +2,11 @@
<project version="4"> <project version="4">
<component name="Palette2"> <component name="Palette2">
<group name="Swing"> <group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false"> <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item> </item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false"> <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item> </item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true"> <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
@ -26,6 +23,9 @@
<property name="text" value="RadioButton" /> <property name="text" value="RadioButton" />
</initial-values> </initial-values>
</item> </item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false"> <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values> <initial-values>
@ -38,11 +38,6 @@
<property name="text" value="Label" /> <property name="text" value="Label" />
</initial-values> </initial-values>
</item> </item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true"> <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" /> <preferred-size width="150" height="-1" />
@ -53,6 +48,11 @@
<preferred-size width="150" height="-1" /> <preferred-size width="150" height="-1" />
</default-constraints> </default-constraints>
</item> </item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true"> <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" /> <preferred-size width="150" height="50" />

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Binary file not shown.

69
registerV.form Normal file
View File

@ -0,0 +1,69 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="registerV">
<grid id="27dc6" binding="panelPrincipal" layout-manager="GridLayoutManager" row-count="7" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="4161a" class="javax.swing.JTextField" binding="nombreText">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="a97e6" class="javax.swing.JLabel" binding="nombreLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Nombre"/>
</properties>
</component>
<component id="4e45c" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Correo"/>
</properties>
</component>
<component id="44135" class="javax.swing.JTextField" binding="emailText">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="47862" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Contraseña"/>
</properties>
</component>
<component id="33198" class="javax.swing.JPasswordField" binding="contrasena1">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="7fb07" class="javax.swing.JButton" binding="registrarseButton" default-binding="true">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Registrarse"/>
</properties>
</component>
</children>
</grid>
</form>

62
registerV.java Normal file
View File

@ -0,0 +1,62 @@
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class registerV {
private JTextField nombreText;
private JLabel nombreLabel;
private JTextField emailText;
private JPasswordField contrasena1;
private JButton registrarseButton;
private JPanel panelPrincipal;
public JPanel getPanel() {
return panelPrincipal;
}
public registerV(){
registrarseButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String nombre = nombreText.getText();
String email = emailText.getText();
String contrasena = String.valueOf(contrasena1.getPassword());
try (Connection conexion = ConexionBD.getConnection()) {
String consulta = "INSERT INTO usuarios (nombre, email, contrasena) VALUES (?, ?, ?)";
try (PreparedStatement statement = conexion.prepareStatement(consulta)) {
statement.setString(1, nombre);
statement.setString(2, email);
statement.setString(3, contrasena);
int filasAfectadas = statement.executeUpdate();
if (filasAfectadas > 0) {
JOptionPane.showMessageDialog(null, "Usuario registrado exitosamente");
// Obtener el JFrame actual y cerrarlo
JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(panelPrincipal);
frame.dispose();
// Mostrar el panel de inicio de sesión
JFrame loginFrame = new JFrame("Inicio de Sesión");
loginFrame.setContentPane(new ventana1().panel);
loginFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
loginFrame.pack();
loginFrame.setVisible(true);
} else {
JOptionPane.showMessageDialog(null, "Error al registrar usuario");
}
}
} catch (SQLException ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(null, "Error de conexión a la base de datos");
}
}
});
}
}

View File

@ -1,80 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="ventana1"> <form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="ventana1">
<grid id="27dc6" binding="panel" layout-manager="GridLayoutManager" row-count="10" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1"> <grid id="27dc6" binding="panel" layout-manager="GridLayoutManager" row-count="11" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="5" left="5" bottom="5" right="5"/> <margin top="5" left="5" bottom="5" right="5"/>
<constraints> <constraints>
<xy x="20" y="20" width="811" height="501"/> <xy x="20" y="20" width="811" height="568"/>
</constraints> </constraints>
<properties/> <properties>
<enabled value="false"/>
<opaque value="false"/>
<visible value="true"/>
</properties>
<border type="none"/> <border type="none"/>
<children> <children>
<hspacer id="53d60"> <hspacer id="b9e01">
<constraints> <constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> <grid row="8" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
</hspacer> </hspacer>
<vspacer id="30226"> <hspacer id="b3d31">
<constraints> <constraints>
<grid row="3" column="0" row-span="6" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> <grid row="7" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
</vspacer> </hspacer>
<component id="c9ab4" class="javax.swing.JTextField" binding="usuariol">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="2b6e4" class="javax.swing.JButton" binding="iniciarBoton">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="INICIAR SESION"/>
</properties>
</component>
<component id="4510e" class="javax.swing.JButton" binding="registerBoton">
<constraints>
<grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="REGISTRARSE"/>
</properties>
</component>
<component id="53a4f" class="javax.swing.JLabel" binding="inicioText"> <component id="53a4f" class="javax.swing.JLabel" binding="inicioText">
<constraints> <constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/> <grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<font name="BankGothic RUSS" size="20" style="1"/> <font size="16" style="1"/>
<text value="Inicio de sesion"/> <text value="Inicio de sesion"/>
</properties> </properties>
</component> </component>
<component id="a9848" class="javax.swing.JLabel"> <component id="4510e" class="javax.swing.JButton" binding="registerBoton">
<constraints> <constraints>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/> <grid row="10" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
<properties> <properties>
<font name="Unispace"/> <text value="REGISTRARSE"/>
<text value="¿No tienes cuenta? Registrate aqui abajo"/>
</properties> </properties>
</component> </component>
<hspacer id="b9e01"> <component id="9040a" class="javax.swing.JLabel">
<constraints> <constraints>
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/> <grid row="2" column="0" row-span="5" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
</hspacer> <properties>
<vspacer id="f63b3"> <icon value="WhatsApp Image 2024-03-04 at 8.01.20 AM.jpeg"/>
<text value=""/>
</properties>
</component>
<component id="9c6ab" class="javax.swing.JLabel" binding="nombre">
<constraints> <constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> <grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints> </constraints>
</vspacer> <properties>
<vspacer id="f2a5a"> <font name="JetBrains Mono" size="20" style="1"/>
<constraints> <horizontalAlignment value="0"/>
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/> <horizontalTextPosition value="0"/>
</constraints> <opaque value="false"/>
</vspacer> <text value="TicketMania"/>
</properties>
</component>
<component id="b0f83" class="javax.swing.JLabel" binding="usuarioLabel"> <component id="b0f83" class="javax.swing.JLabel" binding="usuarioLabel">
<constraints> <constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> <grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
@ -83,6 +68,23 @@
<text value="Usuario"/> <text value="Usuario"/>
</properties> </properties>
</component> </component>
<component id="a9848" class="javax.swing.JLabel">
<constraints>
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<font name="Unispace"/>
<text value="¿No tienes cuenta? Registrate aqui abajo"/>
</properties>
</component>
<component id="c9ab4" class="javax.swing.JTextField" binding="usuariol">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="3c152" class="javax.swing.JLabel" binding="contrasenaLabel"> <component id="3c152" class="javax.swing.JLabel" binding="contrasenaLabel">
<constraints> <constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/> <grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
@ -99,6 +101,14 @@
</constraints> </constraints>
<properties/> <properties/>
</component> </component>
<component id="2b6e4" class="javax.swing.JButton" binding="iniciarBoton">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="INICIAR SESION"/>
</properties>
</component>
</children> </children>
</grid> </grid>
</form> </form>

View File

@ -11,6 +11,7 @@ public class ventana1 {
private JLabel usuarioLabel; private JLabel usuarioLabel;
private JLabel contrasenaLabel; private JLabel contrasenaLabel;
private JLabel inicioText; private JLabel inicioText;
private JLabel nombre;
public ventana1() { public ventana1() {
iniciarBoton.addActionListener(new ActionListener() { iniciarBoton.addActionListener(new ActionListener() {
@ -30,15 +31,23 @@ public class ventana1 {
} }
} }
}); });
}
public static void main(String[] args) { registerBoton.addActionListener(new ActionListener() {
SwingUtilities.invokeLater(() -> { @Override
JFrame frame = new JFrame("Login"); public void actionPerformed(ActionEvent e) {
frame.setContentPane(new ventana1().panel); // Cerrar el JFrame actual (ventana1)
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JFrame frame = (JFrame) SwingUtilities.getWindowAncestor(panel);
frame.pack(); frame.dispose();
frame.setVisible(true);
// Abrir la ventana de registro
JFrame registerFrame = new JFrame("Registro de Usuario");
registerFrame.setContentPane(new registerV().getPanel());
registerFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
registerFrame.pack();
registerFrame.setVisible(true);
}
}); });
} }
} }