This commit is contained in:
xFractu 2024-03-17 12:02:09 -06:00
parent 6cec40596c
commit 7834bd18dd
15 changed files with 378 additions and 156 deletions

View File

@ -33,9 +33,13 @@ dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/ProyectoConciertoApp
excludes=
file.reference.AbsoluteLayout-RELEASE190.jar=src\\Modelo\\AbsoluteLayout-RELEASE190.jar
file.reference.mysql-connector-java-8.0.30.jar=src\\Modelo\\mysql-connector-java-8.0.30.jar
includes=**
jar.compress=false
javac.classpath=
javac.classpath=\
${file.reference.AbsoluteLayout-RELEASE190.jar}:\
${file.reference.mysql-connector-java-8.0.30.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
@ -71,7 +75,7 @@ jlink.additionalmodules=
jlink.additionalparam=
jlink.launcher=true
jlink.launcher.name=ProyectoConciertoApp
main.class=Vista.VentanaConcierto
main.class=proyectoconciertouvct.ProyectoConciertoUVCT
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false

View File

@ -0,0 +1,37 @@
package Modelo;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class conexion {
public static final String driver = "com.mysql.cj.jdbc.Driver";
public static final String URL = "jdbc:mysql://localhost:3306/dbconcierto00";
public static final String USERNAME = "concierto00";
public static final String PASSWORD = "concierto00";
private static Connection con = null;
public static Connection getInstance(){
System.out.println(USERNAME+" "+PASSWORD+" "+URL);
try{
Class.forName(driver);
// Nos conectamos a la bd
System.out.println(USERNAME+" "+PASSWORD+" "+URL);
con= (Connection) DriverManager.getConnection(URL, USERNAME, PASSWORD);
// Si la conexion fue exitosa mostramos un mensaje de conexion exitosa
if (con!=null){
System.out.println("Conectado");
}
}
// Si la conexion NO fue exitosa mostramos un mensaje de error
catch (ClassNotFoundException | SQLException e){
System.out.println("Error de conexion" + e);
}
System.out.println(con);
return con;
}
}

View File

@ -0,0 +1,77 @@
package Vista;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
class BotonConImagen extends JButton {
int cambio = 0;
int precio = 150;
private int id; // Campo id privado
private boolean isAmarillo = false; // Estado para indicar si está utilizando el color amarillo
public BotonConImagen(int id) {
this.id = id;
ImageIcon icono = new ImageIcon("C:/Users/mario/OneDrive/Documentos/NetBeansProjects/Imagene/src/asdasdasdasd.png");
setIcon(icono); // Establece la imagen en el botón
setPreferredSize(new Dimension(icono.getIconWidth(), icono.getIconHeight())); // Establece el tamaño del botón según el tamaño de la imagen
setBorderPainted(false);
setContentAreaFilled(false);
setFocusPainted(false);
// Agrega el ActionListener para cambiar el color del botón
addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (cambio == 0) {
ImageIcon icono = new ImageIcon("C:/Users/mario/OneDrive/Documentos/NetBeansProjects/Imagene/src/asiento seleccion.png");
setIcon(icono); // Establece la imagen en el botón
setPreferredSize(new Dimension(icono.getIconWidth(), icono.getIconHeight())); // Establece el tamaño del botón según el tamaño de la imagen
cambio = 1;
isAmarillo = true;
} else {
ImageIcon icono = new ImageIcon("C:/Users/mario/OneDrive/Documentos/NetBeansProjects/Imagene/src/asdasdasdasd.png");
setIcon(icono); // Establece la imagen en el botón
setPreferredSize(new Dimension(icono.getIconWidth(), icono.getIconHeight())); // Establece el tamaño del botón según el tamaño de la imagen
cambio = 0;
isAmarillo = false;
}
}
});
}
// Métodos getter y setter para el campo id
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getPrecio() {
return precio;
}
public void setPrecio(int precio) {
this.precio = precio;
}
// Método para verificar si el botón está utilizando el color amarillo
public boolean isAmarillo() {
return isAmarillo;
}
public void Ocupado(){
//ImageIcon icono = new ImageIcon("C:/Users/Cesar/Downloads/asiento ocupado.png");
//setIcon(icono); // Establece la imagen en el botón
setEnabled(false);
}
public void Disponible(){
//ImageIcon icono = new ImageIcon("C:/Users/Cesar/Downloads/asiento ocupado.png");
//setIcon(icono); // Establece la imagen en el botón
setEnabled(true);
}
}

View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="MenuP" alignment="1" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="MenuP" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JPanel" name="MenuP">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane1" pref="1200" max="32767" attributes="0"/>
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jPanel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="761" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Properties>
<Property name="horizontalScrollBarPolicy" type="int" value="31"/>
<Property name="verticalScrollBarPolicy" type="int" value="22"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="Principal">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="1188" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="759" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel1">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="106" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -0,0 +1,134 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
*/
package Vista;
/**
*
* @author mario
*/
public class MenuConciertos extends javax.swing.JFrame {
/**
* Creates new form MenuConciertos
*/
public MenuConciertos() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
MenuP = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
Principal = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
javax.swing.GroupLayout PrincipalLayout = new javax.swing.GroupLayout(Principal);
Principal.setLayout(PrincipalLayout);
PrincipalLayout.setHorizontalGroup(
PrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 1188, Short.MAX_VALUE)
);
PrincipalLayout.setVerticalGroup(
PrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 759, Short.MAX_VALUE)
);
jScrollPane1.setViewportView(Principal);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 0, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 106, Short.MAX_VALUE)
);
javax.swing.GroupLayout MenuPLayout = new javax.swing.GroupLayout(MenuP);
MenuP.setLayout(MenuPLayout);
MenuPLayout.setHorizontalGroup(
MenuPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1200, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
MenuPLayout.setVerticalGroup(
MenuPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, MenuPLayout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 761, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(MenuP, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(MenuP, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MenuConciertos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MenuConciertos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MenuConciertos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MenuConciertos.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MenuConciertos().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel MenuP;
private javax.swing.JPanel Principal;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
}

View File

@ -1,154 +0,0 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package Vista;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
class VentanaConcierto extends JFrame {
private JPanel panelLienzoAccesorios, panelLienzoCara, panelLienzoRopaS, panelLienzoRopaI;
private Zonas zonasPanel;
private ZonaPlata zonaPlata;
private ZonaOro zonaOro;
private ZonaPlatino zonaPlatino;
private ZonaDiamante zonaDiamante;
private JPanel panelCentral; // Nuevo panel para contener zonasPanel y zonaPlata
public VentanaConcierto() {
setTitle("AvatART");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(770, 650);
setLocationRelativeTo(null);
getContentPane().setBackground(new Color(200, 160, 255)); // Lila
// Configurar el panel de Zonas
zonasPanel = new Zonas();
zonaPlata = new ZonaPlata();
zonaOro = new ZonaOro();
zonaPlatino = new ZonaPlatino();
zonaDiamante = new ZonaDiamante();
zonaPlata.setPreferredSize(new Dimension(2000, zonaPlata.getPreferredSize().height));
zonaOro.setPreferredSize(new Dimension(2000, zonaOro.getPreferredSize().height));
zonaPlatino.setPreferredSize(new Dimension(1140, zonaPlatino.getPreferredSize().height));
zonaDiamante.setPreferredSize(new Dimension(960, zonaDiamante.getPreferredSize().height));
panelCentral = new JPanel(new BorderLayout()); // Panel central que contendrá zonasPanel y zonaPlata
panelCentral.add(zonasPanel, BorderLayout.CENTER); // Agregar zonasPanel inicialmente
JScrollPane scrollPane = new JScrollPane(panelCentral); // Usar JScrollPane con panelCentral
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
// Ajustar la velocidad del desplazamiento
scrollPane.getHorizontalScrollBar().setUnitIncrement(50); // Ajusta el desplazamiento horizontal más rápido
scrollPane.getVerticalScrollBar().setUnitIncrement(50); // Ajusta el desplazamiento vertical más rápido
add(scrollPane, BorderLayout.CENTER); // Agregar JScrollPane en lugar de zonasPanel directamente
JPanel panelComboBox = new JPanel();
panelComboBox.setLayout(new GridLayout(8, 1, 0, 20)); // Espacio vertical entre componentes
panelComboBox.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
panelComboBox.setBackground(new Color(200, 160, 255)); // Lila
JLabel label1 = new JLabel("Elige tus accesorios");
label1.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
JLabel label2 = new JLabel("Elige tu cabeza");
label2.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
JLabel label3 = new JLabel("Elige tu ropa superior");
label3.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
JLabel label4 = new JLabel("Elige tu ropa inferior");
label4.setFont(new Font("Comic Sans MS", Font.BOLD, 20));
panelComboBox.add(label1);
panelComboBox.add(label2);
panelComboBox.add(label3);
panelComboBox.add(label4);
// Crear un botón para volver al estado inicial
JButton btnVolver = new JButton("Volver");
btnVolver.addActionListener(e -> {
cambiarPanelCentral(zonasPanel); // Volver al estado inicial cuando se hace clic en el botón
});
panelComboBox.add(btnVolver); // Agregar el botón al panelComboBox
// Panel para el título "AvatArt"
JPanel panelTitulo = new JPanel();
JLabel labelTitulo = new JLabel("AvatART", SwingConstants.LEFT);
labelTitulo.setFont(new Font("Comic Sans MS", Font.BOLD, 50));
panelTitulo.add(labelTitulo);
panelTitulo.setBackground(new Color(200, 160, 255));
add(panelTitulo, BorderLayout.NORTH);
add(panelComboBox, BorderLayout.WEST);
setVisible(true);
// Agregar Mouse Listeners
agregarMouseListeners();
}
private void agregarMouseListeners() {
zonasPanel.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
int mouseX = e.getX();
int mouseY = e.getY();
if (zonasPanel.isPointInsidePolygon(mouseX, mouseY, zonasPanel.getXPoints(), zonasPanel.getYPoints())) {
JOptionPane.showMessageDialog(null, "Zona Plata");
cambiarPanelCentral(zonaPlata); // Cambiar a zonaPlata cuando se hace clic en la zona
} else if (zonasPanel.isPointInsidePolygon(mouseX, mouseY, zonasPanel.getXPoints2(), zonasPanel.getYPoints2())) {
JOptionPane.showMessageDialog(null, "Zona Oro");
cambiarPanelCentral(zonaOro); // Cambiar a zonaOro cuando se hace clic en la zona
} else if (zonasPanel.isPointInsidePolygon(mouseX, mouseY, zonasPanel.getXPoints3(), zonasPanel.getYPoints3())) {
JOptionPane.showMessageDialog(null, "Zona Platino");
cambiarPanelCentral(zonaPlatino); // Cambiar a zonaPlatino cuando se hace clic en la zona
} else if (zonasPanel.isPointInsidePolygon(mouseX, mouseY, zonasPanel.getXPoints4(), zonasPanel.getYPoints4())) {
JOptionPane.showMessageDialog(null, "Zona Diamante");
cambiarPanelCentral(zonaDiamante); // Cambiar a zonaDiamante cuando se hace clic en la zona
}
}
@Override
public void mouseEntered(MouseEvent e) {
Object source = e.getSource();
if (source instanceof Component) {
Component component = (Component) source;
component.setForeground(component.getForeground().darker());
zonasPanel.repaint();
}
}
@Override
public void mouseExited(MouseEvent e) {
Object source = e.getSource();
if (source instanceof Component) {
Component component = (Component) source;
component.setForeground(zonasPanel.getCurrentColor());
zonasPanel.repaint();
}
}
});
}
// Método para cambiar el contenido del panel central
private void cambiarPanelCentral(Component nuevoContenido) {
panelCentral.removeAll(); // Limpiar el panel central
panelCentral.add(nuevoContenido, BorderLayout.CENTER); // Agregar el nuevo contenido
panelCentral.revalidate(); // Revalidar el panel para reflejar los cambios
panelCentral.repaint(); // Repintar el panel
}
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
VentanaConcierto vista = new VentanaConcierto();
});
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -0,0 +1,25 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
package proyectoconciertouvct;
import Vista.VentanaConciertos;
/**
*
* @author mario
*/
public class ProyectoConciertoUVCT {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
VentanaConciertos ventana = new VentanaConciertos();
ventana.setVisible(true);
}
}