diff --git a/README.md b/README.md
index 8d834e2..716475b 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,33 @@
-# BookStockManager
-
+# BookStockManager
+
+Bem-vindo ao **BookStockManager**, um software desenvolvido em Java com foco em programação orientada a objetos, ideal para gerenciar pequenas livrarias de forma eficiente e intuitiva.
+
+## Funcionalidades
+
+O **BookStockManager** oferece uma ampla gama de funcionalidades para facilitar a administração da sua livraria:
+
+### Gerenciamento de Estoque
+- **Adicionar** novos produtos ao catálogo.
+- **Remover** produtos obsoletos ou indesejados.
+- **Editar** a quantidade de itens em estoque.
+- **Excluir** produtos específicos do sistema.
+
+### Gerenciamento de Funcionários e Clientes
+- **Acesso completo** à lista de funcionários e clientes cadastrados.
+- **Adicionar e remover** funcionários que trabalham na livraria.
+- Visualizar dados detalhados de cadastro e informações organizadas em tabelas.
+
+### Gerenciamento de Compras
+- Realizar **pedidos diretamente no sistema**.
+- Estoque atualizado automaticamente após a confirmação da compra.
+
+## Requisitos do Sistema
+- **Java**: É necessário ter a versão mais recente instalada para executar o aplicativo.
+
+## Como Executar
+1. Acesse a pasta `dist` do projeto.
+2. Baixe e execute o arquivo `BookStockManager.jar`.
+
+Com o **BookStockManager**, a administração da sua livraria será prática, eficiente e organizada.
+
+---
diff --git a/build/classes/.netbeans_automatic_build b/build/classes/.netbeans_automatic_build
deleted file mode 100644
index e69de29..0000000
diff --git a/build/classes/.netbeans_update_resources b/build/classes/.netbeans_update_resources
deleted file mode 100644
index e69de29..0000000
diff --git a/build/classes/Compra/Produto.class b/build/classes/Compra/Produto.class
deleted file mode 100644
index 4616f08..0000000
Binary files a/build/classes/Compra/Produto.class and /dev/null differ
diff --git a/build/classes/bookstockmanager/BookStockManager.class b/build/classes/bookstockmanager/BookStockManager.class
deleted file mode 100644
index 24dc125..0000000
Binary files a/build/classes/bookstockmanager/BookStockManager.class and /dev/null differ
diff --git a/build/classes/classes/Carrinho.class b/build/classes/classes/Carrinho.class
index dcfd33a..df84bd4 100644
Binary files a/build/classes/classes/Carrinho.class and b/build/classes/classes/Carrinho.class differ
diff --git a/build/classes/classes/Cliente.class b/build/classes/classes/Cliente.class
index 8af4a9f..f747da4 100644
Binary files a/build/classes/classes/Cliente.class and b/build/classes/classes/Cliente.class differ
diff --git a/build/classes/classes/Estoque.class b/build/classes/classes/Estoque.class
index 2f2447b..3f2c815 100644
Binary files a/build/classes/classes/Estoque.class and b/build/classes/classes/Estoque.class differ
diff --git a/build/classes/classes/Funcionario.class b/build/classes/classes/Funcionario.class
index 8ae03ed..caf8963 100644
Binary files a/build/classes/classes/Funcionario.class and b/build/classes/classes/Funcionario.class differ
diff --git a/build/classes/classes/Gerente.class b/build/classes/classes/Gerente.class
index a4433e6..9ed6fe0 100644
Binary files a/build/classes/classes/Gerente.class and b/build/classes/classes/Gerente.class differ
diff --git a/build/classes/classes/Pagamento.class b/build/classes/classes/Pagamento.class
index 418b0db..83d9277 100644
Binary files a/build/classes/classes/Pagamento.class and b/build/classes/classes/Pagamento.class differ
diff --git a/build/classes/classes/Pedido.class b/build/classes/classes/Pedido.class
index 5e13cb6..f56401e 100644
Binary files a/build/classes/classes/Pedido.class and b/build/classes/classes/Pedido.class differ
diff --git a/build/classes/classes/Produto.class b/build/classes/classes/Produto.class
index 0234dc6..3b903d7 100644
Binary files a/build/classes/classes/Produto.class and b/build/classes/classes/Produto.class differ
diff --git a/build/classes/classes/Usuario.class b/build/classes/classes/Usuario.class
index 21ee251..83945b9 100644
Binary files a/build/classes/classes/Usuario.class and b/build/classes/classes/Usuario.class differ
diff --git a/build/classes/telas/Menu$1.class b/build/classes/telas/Menu$1.class
index 81945ef..e4e68da 100644
Binary files a/build/classes/telas/Menu$1.class and b/build/classes/telas/Menu$1.class differ
diff --git a/build/classes/telas/Menu$2.class b/build/classes/telas/Menu$2.class
index b1e8627..7791d31 100644
Binary files a/build/classes/telas/Menu$2.class and b/build/classes/telas/Menu$2.class differ
diff --git a/build/classes/telas/Menu$3.class b/build/classes/telas/Menu$3.class
index d9aaa48..981c599 100644
Binary files a/build/classes/telas/Menu$3.class and b/build/classes/telas/Menu$3.class differ
diff --git a/build/classes/telas/Menu$4.class b/build/classes/telas/Menu$4.class
index e565802..7c2f1cf 100644
Binary files a/build/classes/telas/Menu$4.class and b/build/classes/telas/Menu$4.class differ
diff --git a/build/classes/telas/Menu$5.class b/build/classes/telas/Menu$5.class
index bc3ab9f..ba2a29f 100644
Binary files a/build/classes/telas/Menu$5.class and b/build/classes/telas/Menu$5.class differ
diff --git a/build/classes/telas/Menu$6.class b/build/classes/telas/Menu$6.class
index 34f778c..5fbf54a 100644
Binary files a/build/classes/telas/Menu$6.class and b/build/classes/telas/Menu$6.class differ
diff --git a/build/classes/telas/Menu$7.class b/build/classes/telas/Menu$7.class
index 312c213..90cd014 100644
Binary files a/build/classes/telas/Menu$7.class and b/build/classes/telas/Menu$7.class differ
diff --git a/build/classes/telas/Menu$8.class b/build/classes/telas/Menu$8.class
index 1b4814f..31a92f7 100644
Binary files a/build/classes/telas/Menu$8.class and b/build/classes/telas/Menu$8.class differ
diff --git a/build/classes/telas/Menu.class b/build/classes/telas/Menu.class
index aed4bfe..6af63dd 100644
Binary files a/build/classes/telas/Menu.class and b/build/classes/telas/Menu.class differ
diff --git a/build/classes/telas/Menu.form b/build/classes/telas/Menu.form
deleted file mode 100644
index b2c096d..0000000
--- a/build/classes/telas/Menu.form
+++ /dev/null
@@ -1,296 +0,0 @@
-
-
-
diff --git a/build/classes/telas/areaCliente$1.class b/build/classes/telas/areaCliente$1.class
index 3697381..7a3c1aa 100644
Binary files a/build/classes/telas/areaCliente$1.class and b/build/classes/telas/areaCliente$1.class differ
diff --git a/build/classes/telas/areaCliente$2.class b/build/classes/telas/areaCliente$2.class
index a5a56bc..6b3612d 100644
Binary files a/build/classes/telas/areaCliente$2.class and b/build/classes/telas/areaCliente$2.class differ
diff --git a/build/classes/telas/areaCliente$3.class b/build/classes/telas/areaCliente$3.class
index e1012e9..4304a97 100644
Binary files a/build/classes/telas/areaCliente$3.class and b/build/classes/telas/areaCliente$3.class differ
diff --git a/build/classes/telas/areaCliente$4.class b/build/classes/telas/areaCliente$4.class
index 3f2c341..0489f96 100644
Binary files a/build/classes/telas/areaCliente$4.class and b/build/classes/telas/areaCliente$4.class differ
diff --git a/build/classes/telas/areaCliente$5.class b/build/classes/telas/areaCliente$5.class
index 5738189..fb5d8e5 100644
Binary files a/build/classes/telas/areaCliente$5.class and b/build/classes/telas/areaCliente$5.class differ
diff --git a/build/classes/telas/areaCliente$6.class b/build/classes/telas/areaCliente$6.class
deleted file mode 100644
index a42d6a8..0000000
Binary files a/build/classes/telas/areaCliente$6.class and /dev/null differ
diff --git a/build/classes/telas/areaCliente$7.class b/build/classes/telas/areaCliente$7.class
deleted file mode 100644
index 33ec6a1..0000000
Binary files a/build/classes/telas/areaCliente$7.class and /dev/null differ
diff --git a/build/classes/telas/areaCliente$8.class b/build/classes/telas/areaCliente$8.class
deleted file mode 100644
index 6b0c8c1..0000000
Binary files a/build/classes/telas/areaCliente$8.class and /dev/null differ
diff --git a/build/classes/telas/areaCliente$9.class b/build/classes/telas/areaCliente$9.class
deleted file mode 100644
index f23c9ef..0000000
Binary files a/build/classes/telas/areaCliente$9.class and /dev/null differ
diff --git a/build/classes/telas/areaCliente.class b/build/classes/telas/areaCliente.class
index dff690b..2294e92 100644
Binary files a/build/classes/telas/areaCliente.class and b/build/classes/telas/areaCliente.class differ
diff --git a/build/classes/telas/areaCliente.form b/build/classes/telas/areaCliente.form
deleted file mode 100644
index 9eeb4a5..0000000
--- a/build/classes/telas/areaCliente.form
+++ /dev/null
@@ -1,337 +0,0 @@
-
-
-
diff --git a/build/classes/telas/areaFuncionario$1.class b/build/classes/telas/areaFuncionario$1.class
index 388717d..625ee3f 100644
Binary files a/build/classes/telas/areaFuncionario$1.class and b/build/classes/telas/areaFuncionario$1.class differ
diff --git a/build/classes/telas/areaFuncionario$2.class b/build/classes/telas/areaFuncionario$2.class
index 43638e9..b22ee24 100644
Binary files a/build/classes/telas/areaFuncionario$2.class and b/build/classes/telas/areaFuncionario$2.class differ
diff --git a/build/classes/telas/areaFuncionario$3.class b/build/classes/telas/areaFuncionario$3.class
index bea8803..24c25c9 100644
Binary files a/build/classes/telas/areaFuncionario$3.class and b/build/classes/telas/areaFuncionario$3.class differ
diff --git a/build/classes/telas/areaFuncionario$4.class b/build/classes/telas/areaFuncionario$4.class
index 40fdcf8..0a62700 100644
Binary files a/build/classes/telas/areaFuncionario$4.class and b/build/classes/telas/areaFuncionario$4.class differ
diff --git a/build/classes/telas/areaFuncionario.class b/build/classes/telas/areaFuncionario.class
index a808402..645b32a 100644
Binary files a/build/classes/telas/areaFuncionario.class and b/build/classes/telas/areaFuncionario.class differ
diff --git a/build/classes/telas/areaFuncionario.form b/build/classes/telas/areaFuncionario.form
deleted file mode 100644
index 9618935..0000000
--- a/build/classes/telas/areaFuncionario.form
+++ /dev/null
@@ -1,255 +0,0 @@
-
-
-
diff --git a/build/classes/telas/areaGerente$1.class b/build/classes/telas/areaGerente$1.class
index be1de62..b4cef17 100644
Binary files a/build/classes/telas/areaGerente$1.class and b/build/classes/telas/areaGerente$1.class differ
diff --git a/build/classes/telas/areaGerente$2.class b/build/classes/telas/areaGerente$2.class
index e3b0d8a..3b72ade 100644
Binary files a/build/classes/telas/areaGerente$2.class and b/build/classes/telas/areaGerente$2.class differ
diff --git a/build/classes/telas/areaGerente$3.class b/build/classes/telas/areaGerente$3.class
index f9ecdec..0050c70 100644
Binary files a/build/classes/telas/areaGerente$3.class and b/build/classes/telas/areaGerente$3.class differ
diff --git a/build/classes/telas/areaGerente$4.class b/build/classes/telas/areaGerente$4.class
index 4316089..bafb2c8 100644
Binary files a/build/classes/telas/areaGerente$4.class and b/build/classes/telas/areaGerente$4.class differ
diff --git a/build/classes/telas/areaGerente$5.class b/build/classes/telas/areaGerente$5.class
index 04b3235..07acc41 100644
Binary files a/build/classes/telas/areaGerente$5.class and b/build/classes/telas/areaGerente$5.class differ
diff --git a/build/classes/telas/areaGerente$6.class b/build/classes/telas/areaGerente$6.class
index c7725c2..48d6918 100644
Binary files a/build/classes/telas/areaGerente$6.class and b/build/classes/telas/areaGerente$6.class differ
diff --git a/build/classes/telas/areaGerente$7.class b/build/classes/telas/areaGerente$7.class
index f8a9adf..51fa807 100644
Binary files a/build/classes/telas/areaGerente$7.class and b/build/classes/telas/areaGerente$7.class differ
diff --git a/build/classes/telas/areaGerente$8.class b/build/classes/telas/areaGerente$8.class
index 8562f17..0d58506 100644
Binary files a/build/classes/telas/areaGerente$8.class and b/build/classes/telas/areaGerente$8.class differ
diff --git a/build/classes/telas/areaGerente$9.class b/build/classes/telas/areaGerente$9.class
index e878e23..5bd7c77 100644
Binary files a/build/classes/telas/areaGerente$9.class and b/build/classes/telas/areaGerente$9.class differ
diff --git a/build/classes/telas/areaGerente.class b/build/classes/telas/areaGerente.class
index 6e3f4e3..ad9714f 100644
Binary files a/build/classes/telas/areaGerente.class and b/build/classes/telas/areaGerente.class differ
diff --git a/build/classes/telas/areaGerente.form b/build/classes/telas/areaGerente.form
deleted file mode 100644
index 5d716f0..0000000
--- a/build/classes/telas/areaGerente.form
+++ /dev/null
@@ -1,695 +0,0 @@
-
-
-
diff --git a/build/classes/telas/cadastarGerente$1.class b/build/classes/telas/cadastarGerente$1.class
index 8c6380a..e8b7901 100644
Binary files a/build/classes/telas/cadastarGerente$1.class and b/build/classes/telas/cadastarGerente$1.class differ
diff --git a/build/classes/telas/cadastarGerente$2.class b/build/classes/telas/cadastarGerente$2.class
index 54ba980..5815bb3 100644
Binary files a/build/classes/telas/cadastarGerente$2.class and b/build/classes/telas/cadastarGerente$2.class differ
diff --git a/build/classes/telas/cadastarGerente.class b/build/classes/telas/cadastarGerente.class
index ef75a61..eb9bd87 100644
Binary files a/build/classes/telas/cadastarGerente.class and b/build/classes/telas/cadastarGerente.class differ
diff --git a/build/classes/telas/cadastarGerente.form b/build/classes/telas/cadastarGerente.form
deleted file mode 100644
index 446b855..0000000
--- a/build/classes/telas/cadastarGerente.form
+++ /dev/null
@@ -1,211 +0,0 @@
-
-
-
diff --git a/build/classes/telas/cadastrarCliente$1.class b/build/classes/telas/cadastrarCliente$1.class
index d382efa..9432546 100644
Binary files a/build/classes/telas/cadastrarCliente$1.class and b/build/classes/telas/cadastrarCliente$1.class differ
diff --git a/build/classes/telas/cadastrarCliente$2.class b/build/classes/telas/cadastrarCliente$2.class
index ee62643..a1b93b3 100644
Binary files a/build/classes/telas/cadastrarCliente$2.class and b/build/classes/telas/cadastrarCliente$2.class differ
diff --git a/build/classes/telas/cadastrarCliente.class b/build/classes/telas/cadastrarCliente.class
index 4f990d2..8b2d3b4 100644
Binary files a/build/classes/telas/cadastrarCliente.class and b/build/classes/telas/cadastrarCliente.class differ
diff --git a/build/classes/telas/cadastrarCliente.form b/build/classes/telas/cadastrarCliente.form
deleted file mode 100644
index fe416fe..0000000
--- a/build/classes/telas/cadastrarCliente.form
+++ /dev/null
@@ -1,300 +0,0 @@
-
-
-
diff --git a/build/classes/telas/cadastrarFuncionario$1.class b/build/classes/telas/cadastrarFuncionario$1.class
index 6f9db5c..59de5fc 100644
Binary files a/build/classes/telas/cadastrarFuncionario$1.class and b/build/classes/telas/cadastrarFuncionario$1.class differ
diff --git a/build/classes/telas/cadastrarFuncionario$2.class b/build/classes/telas/cadastrarFuncionario$2.class
index 4579f3c..abfa257 100644
Binary files a/build/classes/telas/cadastrarFuncionario$2.class and b/build/classes/telas/cadastrarFuncionario$2.class differ
diff --git a/build/classes/telas/cadastrarFuncionario.class b/build/classes/telas/cadastrarFuncionario.class
index ae7a605..28e0bf6 100644
Binary files a/build/classes/telas/cadastrarFuncionario.class and b/build/classes/telas/cadastrarFuncionario.class differ
diff --git a/build/classes/telas/cadastrarFuncionario.form b/build/classes/telas/cadastrarFuncionario.form
deleted file mode 100644
index 118b8dc..0000000
--- a/build/classes/telas/cadastrarFuncionario.form
+++ /dev/null
@@ -1,245 +0,0 @@
-
-
-
diff --git a/build/classes/telas/telaLogin$1.class b/build/classes/telas/telaLogin$1.class
index 4d04b30..f98f220 100644
Binary files a/build/classes/telas/telaLogin$1.class and b/build/classes/telas/telaLogin$1.class differ
diff --git a/build/classes/telas/telaLogin.class b/build/classes/telas/telaLogin.class
index 159644d..757a4c8 100644
Binary files a/build/classes/telas/telaLogin.class and b/build/classes/telas/telaLogin.class differ
diff --git a/build/classes/telas/telaLogin.form b/build/classes/telas/telaLogin.form
deleted file mode 100644
index aec091d..0000000
--- a/build/classes/telas/telaLogin.form
+++ /dev/null
@@ -1,177 +0,0 @@
-
-
-
diff --git a/build/classes/telas/telaPagamento$1.class b/build/classes/telas/telaPagamento$1.class
index 0341d92..305fb24 100644
Binary files a/build/classes/telas/telaPagamento$1.class and b/build/classes/telas/telaPagamento$1.class differ
diff --git a/build/classes/telas/telaPagamento.class b/build/classes/telas/telaPagamento.class
index a31b75d..4599b21 100644
Binary files a/build/classes/telas/telaPagamento.class and b/build/classes/telas/telaPagamento.class differ
diff --git a/build/classes/telas/telaPagamento.form b/build/classes/telas/telaPagamento.form
deleted file mode 100644
index 59498b9..0000000
--- a/build/classes/telas/telaPagamento.form
+++ /dev/null
@@ -1,181 +0,0 @@
-
-
-
diff --git a/build/classes/telas/verCarrinho$1.class b/build/classes/telas/verCarrinho$1.class
index 3c36fce..c46d62d 100644
Binary files a/build/classes/telas/verCarrinho$1.class and b/build/classes/telas/verCarrinho$1.class differ
diff --git a/build/classes/telas/verCarrinho$2.class b/build/classes/telas/verCarrinho$2.class
index 06284c9..42a48b7 100644
Binary files a/build/classes/telas/verCarrinho$2.class and b/build/classes/telas/verCarrinho$2.class differ
diff --git a/build/classes/telas/verCarrinho.class b/build/classes/telas/verCarrinho.class
index fecd84f..67ffbf8 100644
Binary files a/build/classes/telas/verCarrinho.class and b/build/classes/telas/verCarrinho.class differ
diff --git a/build/classes/telas/verCarrinho.form b/build/classes/telas/verCarrinho.form
deleted file mode 100644
index baaf9d5..0000000
--- a/build/classes/telas/verCarrinho.form
+++ /dev/null
@@ -1,201 +0,0 @@
-
-
-
diff --git a/build/classes/telas/verProdutos$1.class b/build/classes/telas/verProdutos$1.class
index be364af..82d0d12 100644
Binary files a/build/classes/telas/verProdutos$1.class and b/build/classes/telas/verProdutos$1.class differ
diff --git a/build/classes/telas/verProdutos$2.class b/build/classes/telas/verProdutos$2.class
index ed2c5b3..e201e97 100644
Binary files a/build/classes/telas/verProdutos$2.class and b/build/classes/telas/verProdutos$2.class differ
diff --git a/build/classes/telas/verProdutos$3.class b/build/classes/telas/verProdutos$3.class
index 59be3f6..036821c 100644
Binary files a/build/classes/telas/verProdutos$3.class and b/build/classes/telas/verProdutos$3.class differ
diff --git a/build/classes/telas/verProdutos$4.class b/build/classes/telas/verProdutos$4.class
index da93a77..9fca55a 100644
Binary files a/build/classes/telas/verProdutos$4.class and b/build/classes/telas/verProdutos$4.class differ
diff --git a/build/classes/telas/verProdutos.class b/build/classes/telas/verProdutos.class
index e935a1a..891cb99 100644
Binary files a/build/classes/telas/verProdutos.class and b/build/classes/telas/verProdutos.class differ
diff --git a/build/classes/telas/verProdutos.form b/build/classes/telas/verProdutos.form
deleted file mode 100644
index 6c661da..0000000
--- a/build/classes/telas/verProdutos.form
+++ /dev/null
@@ -1,213 +0,0 @@
-
-
-
diff --git a/dist/BookStockManager.jar b/dist/BookStockManager.jar
new file mode 100644
index 0000000..19e6190
Binary files /dev/null and b/dist/BookStockManager.jar differ
diff --git a/dist/README.TXT b/dist/README.TXT
new file mode 100644
index 0000000..ea2bd49
--- /dev/null
+++ b/dist/README.TXT
@@ -0,0 +1,32 @@
+========================
+BUILD OUTPUT DESCRIPTION
+========================
+
+When you build an Java application project that has a main class, the IDE
+automatically copies all of the JAR
+files on the projects classpath to your projects dist/lib folder. The IDE
+also adds each of the JAR files to the Class-Path element in the application
+JAR files manifest file (MANIFEST.MF).
+
+To run the project from the command line, go to the dist folder and
+type the following:
+
+java -jar "BookStockManager.jar"
+
+To distribute this project, zip up the dist folder (including the lib folder)
+and distribute the ZIP file.
+
+Notes:
+
+* If two JAR files on the project classpath have the same name, only the first
+JAR file is copied to the lib folder.
+* Only JAR files are copied to the lib folder.
+If the classpath contains other types of files or folders, these files (folders)
+are not copied.
+* If a library on the projects classpath also has a Class-Path element
+specified in the manifest,the content of the Class-Path element has to be on
+the projects runtime path.
+* To set a main class in a standard Java project, right-click the project node
+in the Projects window and choose Properties. Then click Run and enter the
+class name in the Main Class field. Alternatively, you can manually type the
+class name in the manifest Main-Class element.
diff --git a/dist/lib/AbsoluteLayout.jar b/dist/lib/AbsoluteLayout.jar
new file mode 100644
index 0000000..2a1e92c
Binary files /dev/null and b/dist/lib/AbsoluteLayout.jar differ
diff --git a/nbproject/private/private.properties b/nbproject/private/private.properties
index ac05a3b..af2817e 100644
--- a/nbproject/private/private.properties
+++ b/nbproject/private/private.properties
@@ -1,2 +1,8 @@
compile.on.save=true
+do.depend=false
+do.jar=true
+do.jlink=false
+javac.debug=true
+javadoc.preview=true
+jlink.strip=false
user.properties.file=C:\\Users\\Yuri\\AppData\\Roaming\\NetBeans\\22\\build.properties
diff --git a/nbproject/private/private.xml b/nbproject/private/private.xml
index edbd425..d6085e2 100644
--- a/nbproject/private/private.xml
+++ b/nbproject/private/private.xml
@@ -3,25 +3,36 @@
- file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/cadastarGerente.java
- file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/teste.java
file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/Menu.java
file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/cadastrarCliente.java
- file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/verProdutos.java
- file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/ControleEstoque.java
file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/ControleClientes.java
file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/areaCliente.java
file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/areaFuncionario.java
file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/telaPagamento.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/classes/Produto.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/CriarNovoProduto.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/cadastros.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/classes/Estoque.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/telaLogin.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/verProdutos_a.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/classes/Cliente.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/classes/Pedido.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/cadastarGerente.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/teste.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/classes/Carrinho.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/classes/OperadorSistema.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/classes/Gerente.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/verProdutos.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/ControleEstoque.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/classes/Pagamento.java
file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/verCarrinho.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/classes/Usuario.java
file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/classes/Funcionario.java
file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/cadastrarFuncionario.java
file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/ControleFuncionarios.java
file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/areaGerente.java
- file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/telaLogin.java
- file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/verProdutos_a.java
file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/telas/carrinhosAntigos.java
- file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/classes/Cliente.java
+ file:/E:/@Meus%20Documentos/Documents/NetBeansProjects/BookStockManager/BookStockManager/src/classes/Compra.java
diff --git a/nbproject/project.properties b/nbproject/project.properties
index df9a095..2c8b41f 100644
--- a/nbproject/project.properties
+++ b/nbproject/project.properties
@@ -1,9 +1,10 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
-annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=BookStockManager
+application.vendor=v
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
@@ -32,6 +33,7 @@ dist.jar=${dist.dir}/BookStockManager.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/BookStockManager
+endorsed.classpath=
excludes=
includes=**
jar.compress=false
@@ -72,7 +74,7 @@ jlink.additionalmodules=
jlink.additionalparam=
jlink.launcher=true
jlink.launcher.name=BookStockManager
-main.class=bookstockmanager.BookStockManager
+main.class=telas.Menu
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
diff --git a/src/bookstockmanager/BookStockManager.java b/src/bookstockmanager/BookStockManager.java
deleted file mode 100644
index f6233a3..0000000
--- a/src/bookstockmanager/BookStockManager.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * 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 bookstockmanager;
-
-/**
- *
- * @author Yuri
- */
-public class BookStockManager {
-
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- }
-
-}
diff --git a/src/classes/Carrinho.java b/src/classes/Carrinho.java
index f40f442..67ccf68 100644
--- a/src/classes/Carrinho.java
+++ b/src/classes/Carrinho.java
@@ -1,26 +1,81 @@
package classes;
+import java.util.ArrayList;
import java.util.List;
import java.util.Date;
public class Carrinho {
//Declaração de atributos protegidos do carrinho
protected int numCarrinho;
- protected Date data;
+ protected String data;
protected double total;
- protected List produtos;
+ //lista stática com a lista de produtos no carrinho
+ public static ArrayList listaProdutos = new ArrayList();
+ //ArrayList de produtos que vai ser clonado da lista de Produtos. Ele serve para guardar os itens que foram comprados nesse carrinho na parte de carrinhos anteriores
+ public ArrayList itensNoCarrinho = new ArrayList();
+ private Pedido pedido = new Pedido();
+ private Pagamento pagamento;
+
//Construtor de carrinho. Um vazio e outro com os atributos dados
public Carrinho() {
}
+
+ public Carrinho(int numCarrinho, String data) {
+ this.numCarrinho = numCarrinho;
+ this.data = data;
+ }
- public Carrinho(int numCarrinho, Date data, double total, List produtos) {
+
+
+ public Carrinho(int numCarrinho, String data,ArrayList itensNoCarrinho) {
this.numCarrinho = numCarrinho;
this.data = data;
- this.total = total;
- this.produtos = produtos;
+ this.itensNoCarrinho = itensNoCarrinho;
+ this.total = 0;
+ double saldo = 0;
+ for(Produto item : itensNoCarrinho){
+ saldo += item.getPreço()*item.getQuantidadeComprada();
+
+ }
+ this.total=saldo;
}
+ //Contabiliza o saldo total do carrinho com base nos produtos na lista
+ public void contarSaldo(){
+ double saldo = 0;
+ for(Produto item : itensNoCarrinho){
+ saldo += item.getPreço()*item.getQuantidadeComprada();
+
+ }
+ this.total=saldo;
+
+ }
+ public void addItem(Produto item){
+ itensNoCarrinho.add(item);
+ }
+ public void removeItem(int i){
+ itensNoCarrinho.remove(i);
+ }
+ public void clearLista(){
+ listaProdutos.clear();
+ }
+
+ public String mostarProdutos(ArrayList itensNoCarrinho){
+ StringBuilder resumo = new StringBuilder();
+ for (Produto item : itensNoCarrinho) {
+ resumo.append(item.getTitulo()).append("*").append(item.getQuantidadeComprada()).append("\n");
+ }
+ return resumo.toString();
+
+ }
+ public String mostrarProdutos(){
+ StringBuilder resumo = new StringBuilder();
+ for (Produto item : this.itensNoCarrinho) {
+ resumo.append(item.getTitulo()).append("*").append(item.getQuantidadeComprada()).append("\n");
+ }
+ return resumo.toString();
+ }
//Métodos getters e setters para cada um dos atributos
public int getNumCarrinho() {
@@ -31,13 +86,6 @@ public void setNumCarrinho(int numCarrinho) {
this.numCarrinho = numCarrinho;
}
- public Date getData() {
- return data;
- }
-
- public void setData(Date data) {
- this.data = data;
- }
public double getTotal() {
return total;
@@ -47,13 +95,39 @@ public void setTotal(double total) {
this.total = total;
}
- public List getProdutos() {
- return produtos;
+ public void setData(String data) {
+ this.data = data;
}
- public void setProdutos(List produtos) {
- this.produtos = produtos;
+ public String getData() {
+ return data;
}
-
-
+
+
+ public ArrayList getItensNoCarrinho() {
+ return itensNoCarrinho;
+ }
+
+ public void setItensNoCarrinho(ArrayList itensNoCarrinho) {
+ this.itensNoCarrinho = itensNoCarrinho;
+ }
+
+ public Pedido getPedido() {
+ return pedido;
+ }
+
+ public void setPedido(Pedido pedido) {
+ this.pedido = pedido;
+ }
+
+ public Pagamento getPagamento() {
+ return pagamento;
+ }
+
+ public void setPagamento(Pagamento pagamento) {
+ this.pagamento = pagamento;
+ }
+
+
+
}
diff --git a/src/classes/Cliente.java b/src/classes/Cliente.java
index 87704b9..ee1faee 100644
--- a/src/classes/Cliente.java
+++ b/src/classes/Cliente.java
@@ -4,23 +4,27 @@
*/
package classes;
+import static classes.Estoque.estoque;
import java.util.ArrayList;
+import javax.swing.JOptionPane;
/**
*
* @author Yuri
*/
-public class Cliente extends Usuario{
+public class Cliente extends Usuario implements OperadorSistema{
//A classe de cliente herda de funcionário
//Declaração de atributos privados para o cliente
private String endereco;
private String dataNascimento;
private String celular;
- private ArrayList carrinho;
private String idCliente;
public static ArrayList listaClientes = new ArrayList();
+ public ArrayList listaCarrinho = new ArrayList();
+ //Esse index serve para que a lista de clientes seja acessada na hora do login e o cliente certo seja buscado
+ //MUITO IMPORTANTE.
public static int index_cliente;
@@ -37,6 +41,64 @@ public Cliente(String nome, String CPF, String email, String senha) {
super(nome, CPF, email, senha);
this.idCliente = "0";
}
+ //Método de login que é implementado pelo OperadorSistema
+ @Override
+ public boolean login(String email, String senha) {
+ for(Cliente pessoa : listaClientes){
+ if(email.equals(pessoa.email) && senha.equals(pessoa.senha)){
+ return true;
+ }
+ }
+ return false;
+
+ }
+ //Método de logout que é implementado pelo OperadorSistema
+ @Override
+ public boolean logout() {
+ return logado=false;
+ }
+ //Método de pesquisar que é implementado pelo OperadorSistema.
+ @Override
+ public void pesquisar(String titulo) {
+ for(Produto produto:estoque){
+ if(produto.getTitulo().equals(titulo)){
+ System.out.println("Produto Encontrado");
+ }
+ }
+
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+ //Serve para retornar o email do cliente
+ @Override
+ public String consultarEmail(String cpf,String nome) {
+ boolean found = false;
+ for(Cliente cli:listaClientes){
+ if(cli.getCPF().equals(cpf) && cli.getNome().equals(nome)){
+ found = true;
+ return this.getEmail();
+ }
+ }
+ if(!found){
+ JOptionPane.showMessageDialog(null, "Email não encontrado como cliente no sistema!", "Busca por email", JOptionPane.ERROR_MESSAGE);
+ return "Email não encontrado";
+ }else{
+ JOptionPane.showMessageDialog(null, "Email encontrado com sucesso!", "Busca por email", JOptionPane.INFORMATION_MESSAGE);
+ return this.getEmail();
+ }
+}
+ //Permite que o cliente redefina a sua senha
+ @Override
+ public void esqueciSenha(String email, String cpf, String novaSenha) {
+ for(Cliente cliente : listaClientes){
+ if((cliente.getCPF().equals(cpf))&&(cliente.getEmail().equals(email))){
+ cliente.setSenha(novaSenha);
+ }
+ }
+ }
+ public void Comprar(String produto,int Quantidade){
+ System.out.println("Item adicionado ao carrinho!");
+
+}
@@ -66,14 +128,6 @@ public void setCelular(String celular) {
this.celular = celular;
}
- public ArrayList getCarrinho() {
- return carrinho;
- }
-
- public void setCarrinho(ArrayList carrinho) {
- this.carrinho = carrinho;
- }
-
public Cliente() {
}
@@ -83,10 +137,7 @@ public ArrayList getListaClientes() {
- public void Comprar(String produto,int Quantidade){
- System.out.println("Item adicionado ao carrinho!");
-
-}
+
public String getIdCliente() {
return idCliente;
@@ -98,6 +149,18 @@ public static int getIndex_cliente() {
}
+
+ public ArrayList getListaCarrinho() {
+ return listaCarrinho;
+ }
+
+
+ public void addCarrinhoLista(Carrinho carrinho){
+ listaCarrinho.add(carrinho);
+ }
+
+
+
}
diff --git a/src/classes/Compra.java b/src/classes/Compra.java
index e3fb6d8..c6de05d 100644
--- a/src/classes/Compra.java
+++ b/src/classes/Compra.java
@@ -1,7 +1,10 @@
package classes;
-
+//Classe compra que é uma associação terciária entre Usuário, Carrinho e Produto
public class Compra {
+ //Relaciona um usuário
private Usuario usuario;
+ //Um carrinho
private Carrinho carrinho;
+ //E vários produtos
private Produto[] produto;
}
diff --git a/src/classes/Estoque.java b/src/classes/Estoque.java
index 2269cdf..92a03c0 100644
--- a/src/classes/Estoque.java
+++ b/src/classes/Estoque.java
@@ -10,21 +10,29 @@
*
* @author Yuri
*/
+//Classe de estoque que serve para armazernar todos os produtos em estoque
public class Estoque {
- private ArrayList estoque;
+ public static ArrayList estoque = new ArrayList();
- public static ArrayList listaClientes = new ArrayList();
-
/**
*
* @param produto
*/
+ //Adicionar produto ao estoque
public void addEstoque(Produto produto){
estoque.add(produto);
}
-
+ //Remover produto do estoque
public void removeEstoque(Produto produto){
estoque.remove(produto);
}
+ //Retornar o tamanho da lista de Estoque
+ public int retornarTamanhoEstoque(){
+ return estoque.size();
+ }
+ //Limpar totalmente o estoque
+ public void limparEstoque(){
+ estoque.clear();
+ }
}
diff --git a/src/classes/Funcionario.java b/src/classes/Funcionario.java
index ea2dacf..4ae68eb 100644
--- a/src/classes/Funcionario.java
+++ b/src/classes/Funcionario.java
@@ -4,23 +4,31 @@
*/
package classes;
+import static classes.Cliente.listaClientes;
+import static classes.Estoque.estoque;
import java.util.ArrayList;
/**
*
* @author Yuri
*/
-public class Funcionario extends Usuario{
+
+public class Funcionario extends Usuario implements OperadorSistema{
private String cadastroFuncionario;
public static int index_func;
public static ArrayList listaFuncionarios = new ArrayList();
+ private ArrayList listaCarrinhoFuncionario = new ArrayList();
+
+ //Construtor vazio de funcionário
+ public Funcionario() {
+ }
- //Construtor de Funcionário
+ //Construtor de Funcionário com vários atributos
public Funcionario(String nome, String CPF, String email, String senha) {
super(nome, CPF, email, senha);
- this.cadastroFuncionario= "0";
+ this.cadastroFuncionario= String.valueOf(listaFuncionarios.size());
//this.cadastroFuncionario=String.valueOf(listaFuncionarios.size());
}
@@ -30,17 +38,79 @@ public Funcionario(String nome, String CPF, String email, String senha,String ca
this.cadastroFuncionario = cadastroFuncionario;
}
- public String getCadastroFuncionario() {
- return cadastroFuncionario;
+ //Método toString que retorna o funcionário com seu cadastro
+ @Override
+ public String toString() {
+ return "Funcionario{" + "cadastroFuncionario=" + cadastroFuncionario + '}';
+ }
+ //Método de login que é implementado pela interface
+ @Override
+ public boolean login(String email, String senha) {
+ for(Funcionario func: listaFuncionarios){
+ if(email.equals(func.getEmail()) && senha.equals(func.getSenha())){
+ return true;
+ }
+ }return false;
+ }
+ //Método de logout
+ @Override
+ public boolean logout() {
+ return logado=false;
}
- public void setCadastroFuncionario(String cadastroFuncionario) {
- this.cadastroFuncionario = cadastroFuncionario;
+ //Pesquisar por um produto em específico
+ @Override
+ public void pesquisar(String titulo) {
+ for(Produto produto:estoque){
+ if(produto.getTitulo().equals(titulo)){
+ System.out.println("Produto Encontrado");
+ }
+ }
}
+ //Consulta por emails
@Override
- public String toString() {
- return "Funcionario{" + "cadastroFuncionario=" + cadastroFuncionario + '}';
+ public String consultarEmail(String cpf,String nome) {
+ boolean encontrado = false;
+ for(Funcionario func: listaFuncionarios){
+ if(func.getCPF().equals(cpf)&&(func.getNome().equals(nome))){
+ encontrado = true;
+ return func.getEmail();
+ }
+ }if(!encontrado){
+ return "Email não encontrado";
+ }else{
+ return this.getEmail();
+ }
+ }
+ //Método de esquecer a senha que permite o usuário redefinir a sua senha com uma nova
+ @Override
+ public void esqueciSenha(String email, String cpf, String novaSenha) {
+ for(Funcionario func : listaFuncionarios){
+ if((func.getCPF().equals(cpf))&&(func.getEmail().equals(email))){
+ func.setSenha(novaSenha);
+ }
+ }
+ }
+ //Métodos Getters e Setters para listas de carrinhos
+ public void addListaCarrinhosFuncionarios(Carrinho carrinho2) {
+ listaCarrinhoFuncionario.add(carrinho2);
+ }
+
+ public ArrayList getListaCarrinhoFuncionario() {
+ return listaCarrinhoFuncionario;
+ }
+
+ public void setListaCarrinhoFuncionario(ArrayList listaCarrinhoFuncionario) {
+ this.listaCarrinhoFuncionario = listaCarrinhoFuncionario;
+ }
+
+ public String getCadastroFuncionario() {
+ return cadastroFuncionario;
+ }
+
+ public void setCadastroFuncionario(String cadastroFuncionario) {
+ this.cadastroFuncionario = cadastroFuncionario;
}
diff --git a/src/classes/Gerente.java b/src/classes/Gerente.java
index 7467f07..f603ae2 100644
--- a/src/classes/Gerente.java
+++ b/src/classes/Gerente.java
@@ -4,18 +4,27 @@
*/
package classes;
+import java.util.ArrayList;
+
/**
*
* @author Yuri
*/
-public class Gerente extends Usuario{
+public class Gerente extends Usuario implements OperadorSistema{
//Classe Gerente herda de Usuário
private String cadastroGerente;
+ private ArrayList listaCarrinhoGerente = new ArrayList();
+
//Construtor para Gerente, com os atributos de Usuário
public Gerente(String nome, String CPF, String email, String senha) {
super(nome, CPF, email, senha);
+ this.cadastroGerente = "0";
+ }
+ //construtor para Gerente, sem atributos
+ public Gerente() {
}
+
//Construtor para Gernete com os atributos de usuário + gerente
public Gerente(String nome, String CPF, String email, String senha, String cadastroGerente ) {
@@ -23,14 +32,64 @@ public Gerente(String nome, String CPF, String email, String senha, String cadas
this.cadastroGerente = cadastroGerente;
}
+ //metodo de login herdado da interface OperadorSistema
+ @Override
+ public boolean login(String email, String senha) {
+ if(super.email.equals(email) && super.senha.equals(senha)){
+ return true;
+ }
+ return false;
+
+ }
+ // adicionar o carrinhos de compra do gerente
+ public void addListaCarrinhosGerente(Carrinho carrinho2) {
+ listaCarrinhoGerente.add(carrinho2);
+ }
+
+ //metodo de logout, herdado da interface OperadorSistema
+ @Override
+ public boolean logout() {
+ return logado = false;
+ }
+
+ //metodo de pesquisar, herdado da interface OperadorSistema
+ @Override
+ public void pesquisar(String titulo) {
+
+ throw new UnsupportedOperationException("Not supported yet."); // Generated from nbfs://nbhost/SystemFileSystem/Templates/Classes/Code/GeneratedMethodBody
+ }
+
+ //metodo de consultar e-mail, herdado da interface OperadorSistema
+ @Override
+ public String consultarEmail(String cpf,String nome) {
+ return"admin@gmail.com";
+ }
+
+ //metodo de esqueci a senha, herdado da interface OperadorSistema
+ @Override
+ public void esqueciSenha(String email, String cpf, String novaSenha) {
+ if((this.getCPF().equals(cpf))&&(this.getEmail().equals(email))){
+ this.setSenha(novaSenha);
+ }
+ }
+
+ //pega o carrinho de compras do usuário: gerente
+ public ArrayList getListaCarrinhoGerente() {
+ return listaCarrinhoGerente;
+ }
+
+ //cria o carrinho de compras do usuário: gerente
+ public void setListaCarrinhoGerente(ArrayList listaCarrinhoGerente) {
+ this.listaCarrinhoGerente = listaCarrinhoGerente;
+ }
+
+ //pega o cadastro do usuário: Gerente
public String getCadastroGerente() {
return cadastroGerente;
}
+ //cria o cadastro do usuário: Gerente
public void setCadastroGerente(String cadastroGerente) {
this.cadastroGerente = cadastroGerente;
}
-
-
-
-}
+ }
\ No newline at end of file
diff --git a/src/classes/OperadorSistema.java b/src/classes/OperadorSistema.java
new file mode 100644
index 0000000..135180f
--- /dev/null
+++ b/src/classes/OperadorSistema.java
@@ -0,0 +1,18 @@
+/*
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
+ * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
+ */
+package classes;
+
+/**
+ *
+ * @author Yuri
+ */
+//Definição da Interface: operador do sistema
+public interface OperadorSistema {
+ boolean login(String email,String senha);
+ boolean logout();
+ void pesquisar(String titulo);
+ void esqueciSenha(String email,String cpf,String novaSenha);
+ String consultarEmail(String cpf,String nome);
+}
diff --git a/src/classes/Pagamento.java b/src/classes/Pagamento.java
index 203e869..d889cd5 100644
--- a/src/classes/Pagamento.java
+++ b/src/classes/Pagamento.java
@@ -3,38 +3,31 @@
import java.util.Date;
import java.util.List;
+//classe de finalização do pagamento
public class Pagamento extends Carrinho{
private String formaPagamento;
private String senha;
- private Pedido pedido;
+ private Pedido pedido = new Pedido();
- public Pagamento(String formaPagamento, String senha, int numCarrinho, Date data, double total, List produtos) {
- super(numCarrinho, data, total, produtos);
- this.formaPagamento = formaPagamento;
- this.senha = senha;
- }
-
-
- public String getFormaPagamento() {
- return formaPagamento;
+ //construtor do pagamento sem argumentos
+ public Pagamento() {
+ this.formaPagamento="nada";
}
-
- public void setFormaPagamento(String formaPagamento) {
+
+
+ //construtor do pagamento com entradas
+ public Pagamento(String formaPagamento, String senha, int numCarrinho, Date data, double total, List produtos) {
+ //super(numCarrinho, data, total, produtos);
this.formaPagamento = formaPagamento;
- }
-
- public String getSenha() {
- return senha;
- }
-
- public void setSenha(String senha) {
this.senha = senha;
}
-
+ //método para alterar a forma de pagamento
public void MudarFormaDePagamento(String formaPagamento){
this.formaPagamento = formaPagamento;
}
+
+ //método para efetuar o pagamento
public boolean Pagar(String senha){
if(senha == this.senha){
System.out.println("Pagamento aprovado");
@@ -45,4 +38,29 @@ public boolean Pagar(String senha){
}
}
-}
+ // método para pegar o pedido
+ public Pedido getPedido() {
+ return pedido;
+ }
+
+ //método para pegar a forma de pagamento
+ public String getFormaPagamento() {
+ return formaPagamento;
+ }
+
+ //método para setar a forma de pagamento
+ public void setFormaPagamento(String formaPagamento) {
+ this.formaPagamento = formaPagamento;
+ }
+
+ //método para pegar a senha
+ public String getSenha() {
+ return senha;
+ }
+
+ //método para setar uma nova senha
+ public void setSenha(String senha) {
+ this.senha = senha;
+ }
+
+}
\ No newline at end of file
diff --git a/src/classes/Pedido.java b/src/classes/Pedido.java
index 2c383cb..2e8a81f 100644
--- a/src/classes/Pedido.java
+++ b/src/classes/Pedido.java
@@ -6,6 +6,11 @@ public class Pedido {
private int codRastreio;
private Pagamento pagamento;
+ public Pedido() {
+ }
+
+
+
public Pedido(int codPedido, int codRastreio) {
this.codPedido = codPedido;
this.codRastreio = codRastreio;
diff --git a/src/classes/Produto.java b/src/classes/Produto.java
index 0aed7ef..83a69c4 100644
--- a/src/classes/Produto.java
+++ b/src/classes/Produto.java
@@ -1,21 +1,28 @@
package classes;
-
+//classe do produto
public class Produto {
- public String titulo;
- public double preço;
- public int quantidadeEstoque;
- public String codigoDoProduto;
- public String descrição;
-
- public Produto(String titulo, double preço, int quantidadeEstoque, String codigoDoProduto, String descrição){
+ private String titulo;
+ private double preço;
+ private int quantidadeEstoque;
+ private String codigoDoProduto;
+ private String descrição;
+ private String genero;
+ private String autor;
+ private int quantidadeComprada;
+
+ //método construtor do produto passando todos os argumentos mínimos necessários
+ public Produto(String titulo,String autor,String genero, double preço, int quantidadeEstoque, String codigoDoProduto, String descrição){
this.titulo = titulo;
+ this.autor = autor;
+ this.genero = genero;
this.preço = preço;
this.quantidadeEstoque = quantidadeEstoque;
this.codigoDoProduto = codigoDoProduto;
this.descrição = descrição;
}
+ //método equivalente ao ToString dos produtos
public void MostraDados(){
System.out.println(titulo);
System.out.println(preço);
@@ -24,43 +31,83 @@ public void MostraDados(){
System.out.println(descrição);
}
+ //método para pegar o título do produto
public String getTitulo() {
return titulo;
}
+ //método para setar o título do produto
public void setTitulo(String titulo) {
this.titulo = titulo;
}
+ //método para pegar o preço do produto
public double getPreço() {
return preço;
}
+ //método para setar o preço do produto
public void setPreço(double preço) {
this.preço = preço;
}
+ //método para pegar a quantidade do produto em estoque
public int getQuantidadeEstoque() {
return quantidadeEstoque;
}
+ //método para setar a quantidade do produto
public void setQuantidadeEstoque(int quantidadeEstoque) {
this.quantidadeEstoque = quantidadeEstoque;
}
+ //método para pegar o código do produto
public String getCodigoDoProduto() {
return codigoDoProduto;
}
+ //método para setar o código do produto
public void setCodigoDoProduto(String codigoDoProduto) {
this.codigoDoProduto = codigoDoProduto;
}
-
+
+ //método para pegar a descrição do produto
public String getDescrição() {
return descrição;
}
+ //método para setar a descrição do produto
public void setDescrição(String descrição) {
this.descrição = descrição;
}
-}
+
+ //método para pegar o gênero do produto
+ public String getGenero() {
+ return genero;
+ }
+
+ //método para setar o gênero do produto
+ public void setGenero(String genero) {
+ this.genero = genero;
+ }
+
+ //método para pegar o nome do autor do produto
+ public String getAutor() {
+ return autor;
+ }
+
+ //método para setar o nome do autor do produto
+ public void setAutor(String autor) {
+ this.autor = autor;
+ }
+
+ //método para pegar a quantidade comprada do produto
+ public int getQuantidadeComprada() {
+ return quantidadeComprada;
+ }
+
+ //método para setar a quantidade comprada de: produto
+ public void setQuantidadeComprada(int quantidadeComprada) {
+ this.quantidadeComprada = quantidadeComprada;
+ }
+}
\ No newline at end of file
diff --git a/src/classes/Usuario.java b/src/classes/Usuario.java
index d2d51fc..d4e33cd 100644
--- a/src/classes/Usuario.java
+++ b/src/classes/Usuario.java
@@ -10,8 +10,8 @@
*
* @author Yuri
*/
-abstract class Usuario {
- //Definição da classe abstrata Usuário
+//Definição da classe abstrata Usuário
+public abstract class Usuario implements OperadorSistema{
//Definição de atributos protegidos para a classe abstrata usuário
protected String nome;
@@ -19,11 +19,17 @@ abstract class Usuario {
protected String email;
protected String senha;
static ArrayList listaClientes = new ArrayList(); // Definição de um ArrayList para Clientes
+ public ArrayList listaCarrinho = new ArrayList(); // Definição de um ArrayLista para os carrinhos do usuário
+ private Carrinho carrinho;
+ public static boolean logado = false;
+ public static String user ="anonimo"; // seta o usuário padrão como anônimo
+
+ //método construtor do usuário sem argumentos de entrada (não usado na versão final)
public Usuario(){
this.listaClientes = new ArrayList();
-
}
+
//Definição de construtor para Usuário
public Usuario(String nome,String CPF,String email,String senha){
this.listaClientes = new ArrayList();
@@ -33,8 +39,22 @@ public Usuario(String nome,String CPF,String email,String senha){
this.senha = senha;
}
+ //método toString sobrescrito da versão herdada
+ @Override
+ public String toString() {
+ return "Usuario{" + "nome=" + nome + ", CPF=" + CPF + ", email=" + email + ", senha=" + senha + '}';
+ }
+
+ //método para a redefinição da senha
+ public void esqueciSenha(String CPF,String senhanova){
+ //verifica se o cpf está correto
+ if (CPF.equals(this.CPF)){
+ this.senha = senhanova;
+ System.out.println("Senha atualizada com sucesso!");
+ }
+ }
+
//Definição de Getters e Setters para o Usuário, com seus respectivos atributos
-
public String getNome() {
return nome;
}
@@ -67,23 +87,9 @@ public void setSenha(String senha) {
this.senha = senha;
}
- public String Consultar(String titulo){
- return titulo;
- }
-
- //Override com o toString
- @Override
- public String toString() {
- return "Usuario{" + "nome=" + nome + ", CPF=" + CPF + ", email=" + email + ", senha=" + senha + '}';
- }
-
- public void esqueciSenha(String CPF,String senhanova){
- if (CPF.equals(this.CPF)){
- this.senha = senhanova;
- System.out.println("Senha atualizada com sucesso!");
-
- }
+ //método para pegar a lista de carrinhos do cliente
+ public ArrayList getListaCarrinho() {
+ return listaCarrinho;
}
-
-}
+}
\ No newline at end of file
diff --git a/src/imagens/AreaGerenteNew.png b/src/imagens/AreaGerenteNew.png
new file mode 100644
index 0000000..33e7429
Binary files /dev/null and b/src/imagens/AreaGerenteNew.png differ
diff --git a/src/imagens/BuscarItem.png b/src/imagens/BuscarItem.png
new file mode 100644
index 0000000..8abb3e6
Binary files /dev/null and b/src/imagens/BuscarItem.png differ
diff --git a/src/imagens/Telas/360_F_559104679_E9EW2fuD15ZfrKSDvHkc6QuiTPL92NlY.jpg b/src/imagens/Telas/360_F_559104679_E9EW2fuD15ZfrKSDvHkc6QuiTPL92NlY.jpg
new file mode 100644
index 0000000..7dd53c6
Binary files /dev/null and b/src/imagens/Telas/360_F_559104679_E9EW2fuD15ZfrKSDvHkc6QuiTPL92NlY.jpg differ
diff --git a/src/imagens/Telas/BuscarItem.png b/src/imagens/Telas/BuscarItem.png
new file mode 100644
index 0000000..85d5779
Binary files /dev/null and b/src/imagens/Telas/BuscarItem.png differ
diff --git a/src/imagens/Telas/BuscarProdutos.png b/src/imagens/Telas/BuscarProdutos.png
new file mode 100644
index 0000000..e029052
Binary files /dev/null and b/src/imagens/Telas/BuscarProdutos.png differ
diff --git a/src/imagens/Telas/Cadastro.png b/src/imagens/Telas/Cadastro.png
new file mode 100644
index 0000000..a45df5a
Binary files /dev/null and b/src/imagens/Telas/Cadastro.png differ
diff --git a/src/imagens/Telas/ControleEstoque.png b/src/imagens/Telas/ControleEstoque.png
new file mode 100644
index 0000000..5005481
Binary files /dev/null and b/src/imagens/Telas/ControleEstoque.png differ
diff --git a/src/imagens/Telas/Flying-Castle-thumbnail.jpg b/src/imagens/Telas/Flying-Castle-thumbnail.jpg
new file mode 100644
index 0000000..ff743a8
Binary files /dev/null and b/src/imagens/Telas/Flying-Castle-thumbnail.jpg differ
diff --git a/src/imagens/Telas/Login.png b/src/imagens/Telas/Login.png
new file mode 100644
index 0000000..5202816
Binary files /dev/null and b/src/imagens/Telas/Login.png differ
diff --git a/src/imagens/Telas/Menu.png b/src/imagens/Telas/Menu.png
new file mode 100644
index 0000000..9f40803
Binary files /dev/null and b/src/imagens/Telas/Menu.png differ
diff --git a/src/imagens/Telas/VerCarrinho.png b/src/imagens/Telas/VerCarrinho.png
new file mode 100644
index 0000000..aae14a6
Binary files /dev/null and b/src/imagens/Telas/VerCarrinho.png differ
diff --git a/src/imagens/Telas/d15eda291e7c8954479b0ece7c6385e0.jpg b/src/imagens/Telas/d15eda291e7c8954479b0ece7c6385e0.jpg
new file mode 100644
index 0000000..1904fcd
Binary files /dev/null and b/src/imagens/Telas/d15eda291e7c8954479b0ece7c6385e0.jpg differ
diff --git "a/src/imagens/Telas/\303\201reaCliente.png" "b/src/imagens/Telas/\303\201reaCliente.png"
new file mode 100644
index 0000000..8793c2b
Binary files /dev/null and "b/src/imagens/Telas/\303\201reaCliente.png" differ
diff --git "a/src/imagens/Telas/\303\201reaFuncion\303\241rio.png" "b/src/imagens/Telas/\303\201reaFuncion\303\241rio.png"
new file mode 100644
index 0000000..f0490a9
Binary files /dev/null and "b/src/imagens/Telas/\303\201reaFuncion\303\241rio.png" differ
diff --git "a/src/imagens/Telas/\303\201reaGerente.png" "b/src/imagens/Telas/\303\201reaGerente.png"
new file mode 100644
index 0000000..33e7429
Binary files /dev/null and "b/src/imagens/Telas/\303\201reaGerente.png" differ
diff --git a/src/imagens/logo256.png b/src/imagens/logo256.png
new file mode 100644
index 0000000..cf47c9b
Binary files /dev/null and b/src/imagens/logo256.png differ
diff --git a/src/imagens/logo32.png b/src/imagens/logo32.png
new file mode 100644
index 0000000..f40dabd
Binary files /dev/null and b/src/imagens/logo32.png differ
diff --git a/src/imagens/logo512.png b/src/imagens/logo512.png
new file mode 100644
index 0000000..5b1f0c4
Binary files /dev/null and b/src/imagens/logo512.png differ
diff --git a/src/imagens/logo_128.png b/src/imagens/logo_128.png
new file mode 100644
index 0000000..ca3b3f7
Binary files /dev/null and b/src/imagens/logo_128.png differ
diff --git a/src/imagens/logo_v3.png b/src/imagens/logo_v3.png
new file mode 100644
index 0000000..f5932a4
Binary files /dev/null and b/src/imagens/logo_v3.png differ
diff --git a/src/imagens/simbolos/adicionar.png b/src/imagens/simbolos/adicionar.png
new file mode 100644
index 0000000..60186a0
Binary files /dev/null and b/src/imagens/simbolos/adicionar.png differ
diff --git a/src/imagens/simbolos/aventureiro.png b/src/imagens/simbolos/aventureiro.png
new file mode 100644
index 0000000..42eecb6
Binary files /dev/null and b/src/imagens/simbolos/aventureiro.png differ
diff --git a/src/imagens/simbolos/aventureiro64.png b/src/imagens/simbolos/aventureiro64.png
new file mode 100644
index 0000000..21c34e6
Binary files /dev/null and b/src/imagens/simbolos/aventureiro64.png differ
diff --git a/src/imagens/simbolos/bruxo_1.png b/src/imagens/simbolos/bruxo_1.png
new file mode 100644
index 0000000..79a15cb
Binary files /dev/null and b/src/imagens/simbolos/bruxo_1.png differ
diff --git a/src/imagens/simbolos/caixas64.png b/src/imagens/simbolos/caixas64.png
new file mode 100644
index 0000000..6a38f2c
Binary files /dev/null and b/src/imagens/simbolos/caixas64.png differ
diff --git a/src/imagens/simbolos/carrinho64.png b/src/imagens/simbolos/carrinho64.png
new file mode 100644
index 0000000..c1d3332
Binary files /dev/null and b/src/imagens/simbolos/carrinho64.png differ
diff --git a/src/imagens/simbolos/cavaleiro.png b/src/imagens/simbolos/cavaleiro.png
new file mode 100644
index 0000000..bbc785b
Binary files /dev/null and b/src/imagens/simbolos/cavaleiro.png differ
diff --git a/src/imagens/simbolos/cavaleiro64.png b/src/imagens/simbolos/cavaleiro64.png
new file mode 100644
index 0000000..0ab20ca
Binary files /dev/null and b/src/imagens/simbolos/cavaleiro64.png differ
diff --git a/src/imagens/simbolos/login64.png b/src/imagens/simbolos/login64.png
new file mode 100644
index 0000000..3009bf9
Binary files /dev/null and b/src/imagens/simbolos/login64.png differ
diff --git a/src/imagens/simbolos/pesquisar64.png b/src/imagens/simbolos/pesquisar64.png
new file mode 100644
index 0000000..c5582c5
Binary files /dev/null and b/src/imagens/simbolos/pesquisar64.png differ
diff --git a/src/imagens/simbolos/rei.png b/src/imagens/simbolos/rei.png
new file mode 100644
index 0000000..670f3f1
Binary files /dev/null and b/src/imagens/simbolos/rei.png differ
diff --git a/src/imagens/simbolos/rei64.png b/src/imagens/simbolos/rei64.png
new file mode 100644
index 0000000..b748bdb
Binary files /dev/null and b/src/imagens/simbolos/rei64.png differ
diff --git a/src/imagens/simbolos/sacola.png b/src/imagens/simbolos/sacola.png
new file mode 100644
index 0000000..2acccde
Binary files /dev/null and b/src/imagens/simbolos/sacola.png differ
diff --git a/src/old_london/OldLondon.ttf b/src/old_london/OldLondon.ttf
new file mode 100644
index 0000000..f24a340
Binary files /dev/null and b/src/old_london/OldLondon.ttf differ
diff --git a/src/old_london/OldLondonAlternate.ttf b/src/old_london/OldLondonAlternate.ttf
new file mode 100644
index 0000000..6010ffd
Binary files /dev/null and b/src/old_london/OldLondonAlternate.ttf differ
diff --git a/src/old_london/Olondon_.otf b/src/old_london/Olondon_.otf
new file mode 100644
index 0000000..9a68b20
Binary files /dev/null and b/src/old_london/Olondon_.otf differ
diff --git a/src/old_london/Olondona.otf b/src/old_london/Olondona.otf
new file mode 100644
index 0000000..56161c8
Binary files /dev/null and b/src/old_london/Olondona.otf differ
diff --git a/src/telas/AreaGerenteTeste.form b/src/telas/AreaGerenteTeste.form
deleted file mode 100644
index 667ac14..0000000
--- a/src/telas/AreaGerenteTeste.form
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
diff --git a/src/telas/AreaGerenteTeste.java b/src/telas/AreaGerenteTeste.java
deleted file mode 100644
index a0ec55d..0000000
--- a/src/telas/AreaGerenteTeste.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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 telas;
-
-/**
- *
- * @author Yuri
- */
-public class AreaGerenteTeste extends javax.swing.JFrame {
-
- /**
- * Creates new form AreaGerenteTeste
- */
- public AreaGerenteTeste() {
- 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")
- // //GEN-BEGIN:initComponents
- private void initComponents() {
-
- jPanel1 = new javax.swing.JPanel();
- jLabel1 = new javax.swing.JLabel();
-
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
-
- jPanel1.setBackground(new java.awt.Color(118, 80, 61));
-
- jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/AreaGerente2.png"))); // NOI18N
-
- javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
- jPanel1.setLayout(jPanel1Layout);
- jPanel1Layout.setHorizontalGroup(
- jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(179, 179, 179)
- .addComponent(jLabel1)
- .addContainerGap(306, Short.MAX_VALUE))
- );
- jPanel1Layout.setVerticalGroup(
- jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 353, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(0, 888, Short.MAX_VALUE))
- );
-
- getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
-
- pack();
- }// //GEN-END:initComponents
-
- /**
- * @param args the command line arguments
- */
- public static void main(String args[]) {
- /* Set the Nimbus look and feel */
- //
- /* 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(AreaGerenteTeste.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(AreaGerenteTeste.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(AreaGerenteTeste.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(AreaGerenteTeste.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- }
- //
-
- /* Create and display the form */
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- new AreaGerenteTeste().setVisible(true);
- }
- });
- }
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JLabel jLabel1;
- private javax.swing.JPanel jPanel1;
- // End of variables declaration//GEN-END:variables
-}
diff --git a/src/telas/ControleEstoque.form b/src/telas/ControleEstoque.form
index 68831a7..18be8be 100644
--- a/src/telas/ControleEstoque.form
+++ b/src/telas/ControleEstoque.form
@@ -4,6 +4,9 @@
+
+
+
@@ -19,335 +22,828 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/telas/ControleEstoque.java b/src/telas/ControleEstoque.java
index 4de618d..513ddd3 100644
--- a/src/telas/ControleEstoque.java
+++ b/src/telas/ControleEstoque.java
@@ -4,6 +4,12 @@
*/
package telas;
+import static classes.Estoque.estoque;
+import classes.Produto;
+import javax.swing.JOptionPane;
+import javax.swing.table.DefaultTableModel;
+import static telas.cadastros.cadastrosFlag;
+
/**
*
* @author Yuri
@@ -18,19 +24,35 @@ public ControleEstoque() {
disableEstoqueFields();
disableEstoqueButtons();
+ disableEstoqueAdicaoFields();
+ carregarTabelaProdutos();
+ carregarTabelaProdutosAdicao();
+ disableEstoqueAdicaoButtons();
//btnAddItem.setEnabled(true);
btnPesquisarItem.setEnabled(true);
+ txtCodigoEstoque.setEnabled(false);
+ this.setExtendedState(MAXIMIZED_BOTH);
+ setLocationRelativeTo(null);
+ btnPesquisarItem.setEnabled(true);
+ txtCodigoEstoque.setEnabled(false);
+ lblCodigoEstoque.setEnabled(true);
+ txtGeneroEstoque.setEnabled(false);
+ lblGeneroEstoque.setEnabled(false);
setLocationRelativeTo(null);
}
public void disableEstoqueFields(){
+ lblAutor.setEnabled(false);
+ txtAutor.setEnabled(false);
txtTituloEstoque.setEnabled(false);
txtPrecoEstoque.setEnabled(false);
txtQuantiaEstoque.setEnabled(false);
txtCodigoEstoque.setEnabled(false);
txtDescricaoEstoque.setEnabled(false);
+ txtGeneroEstoque.setEnabled(false);
+
lblTituloEstoque.setEnabled(false);
lblPrecoEstoque.setEnabled(false);
@@ -54,17 +76,122 @@ public void enableEstoqueFields(){
lblDescricaoEstoque.setEnabled(true);
}
+ public void enableEstoqueAdicaoFields(){
+ txtTituloAdicao.setEnabled(true);
+ txtAutorAdicao.setEnabled(true);
+ txtCodigoProdutoAdicao.setEnabled(true);
+ lblCodigoProdutoAdicao.setEnabled(true);
+ lblTituloAdicao.setEnabled(true);
+ lblAutorAdicao.setEnabled(true);
+ }
+ public void disableEstoqueAdicaoFields(){
+ txtTituloAdicao.setEnabled(false);
+ txtAutorAdicao.setEnabled(false);
+ txtCodigoProdutoAdicao.setEnabled(false);
+ lblCodigoProdutoAdicao.setEnabled(false);
+ lblTituloAdicao.setEnabled(false);
+ lblAutorAdicao.setEnabled(false);
+ }
public void disableEstoqueButtons(){
//btnAddItem.setEnabled(false);
btnAlterarItem.setEnabled(false);
btnSalvarItem.setEnabled(false);
- btnExcluirItem.setEnabled(false);
+ //btnExcluirItem.setEnabled(false);
btnCancelarItem.setEnabled(false);
btnPesquisarItem.setEnabled(false);
btnBuscar.setEnabled(false);
}
+ public void disableEstoqueAdicaoButtons(){
+ btnSalvarItemAdicao.setEnabled(false);
+ btnExcluirItemAdicao.setEnabled(false);
+ btnCancelarItemAdicao.setEnabled(false);
+
+
+
+ }
+ public void carregarCamposProduto(){
+ int i = tblMostraProdutos.getSelectedRow();
+ if(i>=0 && i//GEN-BEGIN:initComponents
private void initComponents() {
+ btnSair = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
+ jPanelAlterarItem = new javax.swing.JPanel();
txtTituloEstoque = new javax.swing.JTextField();
+ jScrollPane2 = new javax.swing.JScrollPane();
+ txtDescricaoEstoque = new javax.swing.JTextArea();
txtQuantiaEstoque = new javax.swing.JTextField();
- txtDescricaoEstoque = new javax.swing.JTextField();
- txtPrecoEstoque = new javax.swing.JTextField();
- txtCodigoEstoque = new javax.swing.JTextField();
- lblTituloEstoque = new javax.swing.JLabel();
+ btnPesquisarItem = new javax.swing.JButton();
+ lblAutor = new javax.swing.JLabel();
lblPrecoEstoque = new javax.swing.JLabel();
- lblQuantiaEstoque = new javax.swing.JLabel();
- lblCodigoEstoque = new javax.swing.JLabel();
- lblDescricaoEstoque = new javax.swing.JLabel();
+ btnSalvarItem = new javax.swing.JButton();
btnBuscar = new javax.swing.JButton();
btnAlterarItem = new javax.swing.JButton();
+ lblQuantiaEstoque = new javax.swing.JLabel();
+ lblCodigoEstoque = new javax.swing.JLabel();
+ lblTituloEstoque = new javax.swing.JLabel();
+ txtPrecoEstoque = new javax.swing.JTextField();
+ txtCodigoEstoque = new javax.swing.JTextField();
btnCancelarItem = new javax.swing.JButton();
- btnSalvarItem = new javax.swing.JButton();
- btnPesquisarItem = new javax.swing.JButton();
- btnExcluirItem = new javax.swing.JButton();
+ lblDescricaoEstoque = new javax.swing.JLabel();
lblControleEstoque = new javax.swing.JLabel();
- jButton1 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
- jTable1 = new javax.swing.JTable();
+ tblMostraProdutos = new javax.swing.JTable();
+ txtAutor = new javax.swing.JTextField();
+ lblGeneroEstoque = new javax.swing.JLabel();
+ txtGeneroEstoque = new javax.swing.JTextField();
+ jPanel1 = new javax.swing.JPanel();
+ jPanelAdicaoItem = new javax.swing.JPanel();
+ jScrollPane3 = new javax.swing.JScrollPane();
+ tblMostraProdutosAdicao = new javax.swing.JTable();
+ btnCriar1 = new javax.swing.JButton();
+ btnSalvarItemAdicao = new javax.swing.JButton();
+ btnPesquisarItem1 = new javax.swing.JButton();
+ btnCancelarItemAdicao = new javax.swing.JButton();
+ btnExcluirItemAdicao = new javax.swing.JButton();
+ lblControleAdicao = new javax.swing.JLabel();
+ lblTituloAdicao = new javax.swing.JLabel();
+ txtTituloAdicao = new javax.swing.JTextField();
+ lblCodigoProdutoAdicao = new javax.swing.JLabel();
+ txtCodigoProdutoAdicao = new javax.swing.JTextField();
+ btnBuscarAdicao = new javax.swing.JButton();
+ lblAutorAdicao = new javax.swing.JLabel();
+ txtAutorAdicao = new javax.swing.JTextField();
+ jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Controle do estoque");
+ setIconImage(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/caixas64.png")).getImage());
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ btnSair.setBackground(new java.awt.Color(204, 0, 0));
+ btnSair.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
+ btnSair.setText("Sair");
+ btnSair.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSairActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnSair, new org.netbeans.lib.awtextra.AbsoluteConstraints(1760, 30, -1, 40));
+
+ jPanel2.setBackground(new java.awt.Color(19, 55, 175));
+
+ jPanelAlterarItem.setBackground(new java.awt.Color(0, 164, 164));
txtTituloEstoque.setToolTipText("insira o título do produto");
txtTituloEstoque.addActionListener(new java.awt.event.ActionListener() {
@@ -107,29 +273,49 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});
- txtQuantiaEstoque.setToolTipText("insira a quantia em estoque");
-
- txtDescricaoEstoque.setToolTipText("insira a descrição");
+ txtDescricaoEstoque.setColumns(20);
+ txtDescricaoEstoque.setRows(5);
+ jScrollPane2.setViewportView(txtDescricaoEstoque);
- txtPrecoEstoque.setToolTipText("insira o preço do produto");
+ txtQuantiaEstoque.setToolTipText("insira a quantia em estoque");
- txtCodigoEstoque.setToolTipText("insira o código do produto");
+ btnPesquisarItem.setBackground(new java.awt.Color(153, 153, 255));
+ btnPesquisarItem.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ btnPesquisarItem.setText("Pesquisar");
+ btnPesquisarItem.setToolTipText("pesquisar por título");
+ btnPesquisarItem.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnPesquisarItemActionPerformed(evt);
+ }
+ });
- lblTituloEstoque.setText("Titulo");
+ lblAutor.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ lblAutor.setText("Autor");
+ lblPrecoEstoque.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
lblPrecoEstoque.setText("Preço");
- lblQuantiaEstoque.setText("Quantia em estoque");
-
- lblCodigoEstoque.setText("Código de produto");
-
- lblDescricaoEstoque.setText("Descrição");
+ btnSalvarItem.setBackground(new java.awt.Color(51, 255, 0));
+ btnSalvarItem.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ btnSalvarItem.setText("Salvar");
+ btnSalvarItem.setToolTipText("salvar os dados");
+ btnSalvarItem.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSalvarItemActionPerformed(evt);
+ }
+ });
+ btnBuscar.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
btnBuscar.setText("Buscar");
btnBuscar.setToolTipText("aperte para buscar pelo item");
+ btnBuscar.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnBuscarActionPerformed(evt);
+ }
+ });
btnAlterarItem.setBackground(new java.awt.Color(255, 255, 0));
- btnAlterarItem.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnAlterarItem.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
btnAlterarItem.setText("Alterar Item");
btnAlterarItem.setToolTipText("alterar dados de algum produto");
btnAlterarItem.addActionListener(new java.awt.event.ActionListener() {
@@ -138,8 +324,26 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});
+ lblQuantiaEstoque.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ lblQuantiaEstoque.setText("Quantia em estoque");
+
+ lblCodigoEstoque.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ lblCodigoEstoque.setText("Código de produto");
+
+ lblTituloEstoque.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ lblTituloEstoque.setText("Titulo");
+
+ txtPrecoEstoque.setToolTipText("insira o preço do produto");
+ txtPrecoEstoque.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ txtPrecoEstoqueActionPerformed(evt);
+ }
+ });
+
+ txtCodigoEstoque.setToolTipText("insira o código do produto");
+
btnCancelarItem.setBackground(new java.awt.Color(255, 0, 0));
- btnCancelarItem.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnCancelarItem.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
btnCancelarItem.setText("Cancelar");
btnCancelarItem.setToolTipText("cancelar operação");
btnCancelarItem.addActionListener(new java.awt.event.ActionListener() {
@@ -148,177 +352,414 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});
- btnSalvarItem.setBackground(new java.awt.Color(51, 255, 0));
- btnSalvarItem.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
- btnSalvarItem.setText("Salvar");
- btnSalvarItem.setToolTipText("salvar os dados");
- btnSalvarItem.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- btnSalvarItemActionPerformed(evt);
+ lblDescricaoEstoque.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ lblDescricaoEstoque.setText("Descrição");
+
+ lblControleEstoque.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
+ lblControleEstoque.setText("Controle do estoque - Alteração de item");
+
+ jScrollPane1.setToolTipText("tabela com os produtos em estoque");
+
+ tblMostraProdutos.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+ {null, null, null, null, null, null, null},
+ {null, null, null, null, null, null, null},
+ {null, null, null, null, null, null, null},
+ {null, null, null, null, null, null, null}
+ },
+ new String [] {
+ "Título", "Autor", "Gênero", "Preço", "Qnt. Estoque", "Cód. Prod.", "Descrição"
}
- });
+ ) {
+ Class[] types = new Class [] {
+ java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Double.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class
+ };
+ boolean[] canEdit = new boolean [] {
+ false, false, false, false, false, false, false
+ };
- btnPesquisarItem.setBackground(new java.awt.Color(153, 153, 255));
- btnPesquisarItem.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
- btnPesquisarItem.setText("Pesquisar");
- btnPesquisarItem.setToolTipText("pesquisar por título");
- btnPesquisarItem.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- btnPesquisarItemActionPerformed(evt);
+ public Class getColumnClass(int columnIndex) {
+ return types [columnIndex];
}
- });
- btnExcluirItem.setBackground(new java.awt.Color(153, 153, 153));
- btnExcluirItem.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
- btnExcluirItem.setText("Excluir");
- btnExcluirItem.setToolTipText("Excluir algum produto do estoque");
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return canEdit [columnIndex];
+ }
+ });
+ tblMostraProdutos.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ tblMostraProdutosMouseClicked(evt);
+ }
+ });
+ jScrollPane1.setViewportView(tblMostraProdutos);
+ if (tblMostraProdutos.getColumnModel().getColumnCount() > 0) {
+ tblMostraProdutos.getColumnModel().getColumn(0).setPreferredWidth(50);
+ tblMostraProdutos.getColumnModel().getColumn(1).setPreferredWidth(20);
+ tblMostraProdutos.getColumnModel().getColumn(2).setPreferredWidth(15);
+ tblMostraProdutos.getColumnModel().getColumn(3).setPreferredWidth(8);
+ tblMostraProdutos.getColumnModel().getColumn(4).setPreferredWidth(3);
+ tblMostraProdutos.getColumnModel().getColumn(5).setPreferredWidth(5);
+ tblMostraProdutos.getColumnModel().getColumn(6).setPreferredWidth(100);
+ }
- lblControleEstoque.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N
- lblControleEstoque.setText("Controle do estoque");
+ lblGeneroEstoque.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ lblGeneroEstoque.setText("Gênero");
- jButton1.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
- jButton1.setText("Criar Item");
+ javax.swing.GroupLayout jPanelAlterarItemLayout = new javax.swing.GroupLayout(jPanelAlterarItem);
+ jPanelAlterarItem.setLayout(jPanelAlterarItemLayout);
+ jPanelAlterarItemLayout.setHorizontalGroup(
+ jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelAlterarItemLayout.createSequentialGroup()
+ .addContainerGap(47, Short.MAX_VALUE)
+ .addGroup(jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelAlterarItemLayout.createSequentialGroup()
+ .addComponent(lblControleEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 529, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(165, 165, 165))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelAlterarItemLayout.createSequentialGroup()
+ .addGroup(jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(lblDescricaoEstoque)
+ .addGroup(jPanelAlterarItemLayout.createSequentialGroup()
+ .addComponent(btnAlterarItem)
+ .addGap(59, 59, 59)
+ .addComponent(btnSalvarItem)
+ .addGap(124, 124, 124)
+ .addComponent(btnCancelarItem, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGroup(jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelAlterarItemLayout.createSequentialGroup()
+ .addGap(79, 79, 79)
+ .addComponent(btnPesquisarItem))
+ .addGroup(jPanelAlterarItemLayout.createSequentialGroup()
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGap(64, 64, 64))))
+ .addGroup(jPanelAlterarItemLayout.createSequentialGroup()
+ .addGap(19, 19, 19)
+ .addGroup(jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelAlterarItemLayout.createSequentialGroup()
+ .addComponent(lblCodigoEstoque)
+ .addGap(92, 92, 92)
+ .addGroup(jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(lblPrecoEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(txtPrecoEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanelAlterarItemLayout.createSequentialGroup()
+ .addGap(303, 303, 303)
+ .addComponent(btnBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(lblQuantiaEstoque))
+ .addGap(151, 151, 151))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 820, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanelAlterarItemLayout.createSequentialGroup()
+ .addGroup(jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(txtCodigoEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelAlterarItemLayout.createSequentialGroup()
+ .addComponent(lblAutor, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(txtAutor, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(15, 15, 15))
+ .addGroup(jPanelAlterarItemLayout.createSequentialGroup()
+ .addComponent(lblTituloEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtTituloEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE))))
+ .addGap(62, 62, 62)
+ .addGroup(jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addGroup(jPanelAlterarItemLayout.createSequentialGroup()
+ .addGap(6, 6, 6)
+ .addComponent(lblGeneroEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(txtQuantiaEstoque, javax.swing.GroupLayout.DEFAULT_SIZE, 171, Short.MAX_VALUE)
+ .addComponent(txtGeneroEstoque)))))
+ .addGap(0, 0, Short.MAX_VALUE))
+ );
+ jPanelAlterarItemLayout.setVerticalGroup(
+ jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelAlterarItemLayout.createSequentialGroup()
+ .addComponent(lblControleEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelAlterarItemLayout.createSequentialGroup()
+ .addGroup(jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelAlterarItemLayout.createSequentialGroup()
+ .addGap(36, 36, 36)
+ .addComponent(txtPrecoEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(1, 1, 1)
+ .addComponent(lblQuantiaEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtQuantiaEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(lblGeneroEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanelAlterarItemLayout.createSequentialGroup()
+ .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(31, 31, 31)
+ .addComponent(btnBuscar)))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtGeneroEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(jPanelAlterarItemLayout.createSequentialGroup()
+ .addGroup(jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblTituloEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(txtTituloEstoque)
+ .addComponent(lblPrecoEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblDescricaoEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(18, 18, 18)
+ .addGroup(jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblAutor, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(txtAutor, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(lblCodigoEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtCodigoEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(54, 54, 54)))
+ .addGroup(jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnSalvarItem, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(btnAlterarItem, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanelAlterarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnPesquisarItem, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnCancelarItem, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
+ .addGap(35, 35, 35)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap())
+ );
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
- .addGap(24, 467, Short.MAX_VALUE)
- .addComponent(lblControleEstoque)
- .addGap(386, 386, 386))
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jButton1)
- .addGap(50, 50, 50)
- .addComponent(btnAlterarItem)
- .addGap(65, 65, 65)
- .addComponent(btnSalvarItem)
- .addGap(64, 64, 64))
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addGap(0, 0, Short.MAX_VALUE)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(lblTituloEstoque, javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(lblPrecoEstoque, javax.swing.GroupLayout.Alignment.TRAILING))
- .addGap(18, 18, 18)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(txtTituloEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(txtPrecoEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(34, 34, 34)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addComponent(lblCodigoEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(txtCodigoEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addComponent(lblQuantiaEstoque)
- .addGap(33, 33, 33)
- .addComponent(txtQuantiaEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addComponent(btnCancelarItem)
- .addGap(69, 69, 69)
- .addComponent(btnExcluirItem))
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addComponent(lblDescricaoEstoque)
- .addGap(18, 18, 18)
- .addComponent(txtDescricaoEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addGap(108, 108, 108)
- .addComponent(btnBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE))))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(btnPesquisarItem)
- .addGap(62, 62, 62))
+ .addContainerGap()
+ .addComponent(jPanelAlterarItem, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(lblControleEstoque)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblQuantiaEstoque)
- .addComponent(txtQuantiaEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblCodigoEstoque)
- .addComponent(txtCodigoEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblDescricaoEstoque)
- .addComponent(txtDescricaoEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(btnBuscar)))
- .addGap(27, 27, 27)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(btnAlterarItem)
- .addComponent(btnCancelarItem)
- .addComponent(btnSalvarItem)
- .addComponent(btnPesquisarItem)
- .addComponent(btnExcluirItem)
- .addComponent(jButton1)))
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(txtTituloEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(lblTituloEstoque))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(txtPrecoEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(lblPrecoEstoque)))))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jPanelAlterarItem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(15, Short.MAX_VALUE))
);
- jScrollPane1.setToolTipText("tabela com os produtos em estoque");
+ getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 120, 910, 620));
+
+ jPanel1.setBackground(new java.awt.Color(193, 91, 15));
+
+ jPanelAdicaoItem.setBackground(new java.awt.Color(255, 153, 51));
- jTable1.setModel(new javax.swing.table.DefaultTableModel(
+ jScrollPane3.setToolTipText("tabela com os produtos em estoque");
+
+ tblMostraProdutosAdicao.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null}
+ {null, null, null, null, null, null, null},
+ {null, null, null, null, null, null, null},
+ {null, null, null, null, null, null, null},
+ {null, null, null, null, null, null, null}
},
new String [] {
- "Título", "Preço", "Qnt. Estoque", "Cód. Prod.", "Descrição"
+ "Título", "Autor", "Gênero", "Preço", "Qnt. Estoque", "Cód. Prod.", "Descrição"
}
) {
Class[] types = new Class [] {
- java.lang.String.class, java.lang.Double.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class
+ java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Double.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class
+ };
+ boolean[] canEdit = new boolean [] {
+ false, false, false, false, false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
+
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return canEdit [columnIndex];
+ }
});
- jScrollPane1.setViewportView(jTable1);
-
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(0, 0, Short.MAX_VALUE))
- .addGroup(layout.createSequentialGroup()
- .addGap(79, 79, 79)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 820, javax.swing.GroupLayout.PREFERRED_SIZE)
+ tblMostraProdutosAdicao.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ tblMostraProdutosAdicaoMouseClicked(evt);
+ }
+ });
+ jScrollPane3.setViewportView(tblMostraProdutosAdicao);
+ if (tblMostraProdutosAdicao.getColumnModel().getColumnCount() > 0) {
+ tblMostraProdutosAdicao.getColumnModel().getColumn(0).setPreferredWidth(50);
+ tblMostraProdutosAdicao.getColumnModel().getColumn(1).setPreferredWidth(20);
+ tblMostraProdutosAdicao.getColumnModel().getColumn(2).setPreferredWidth(15);
+ tblMostraProdutosAdicao.getColumnModel().getColumn(3).setPreferredWidth(8);
+ tblMostraProdutosAdicao.getColumnModel().getColumn(4).setPreferredWidth(3);
+ tblMostraProdutosAdicao.getColumnModel().getColumn(5).setPreferredWidth(5);
+ tblMostraProdutosAdicao.getColumnModel().getColumn(6).setPreferredWidth(100);
+ }
+
+ btnCriar1.setBackground(new java.awt.Color(255, 189, 43));
+ btnCriar1.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ btnCriar1.setText("Criar Item");
+ btnCriar1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCriar1ActionPerformed(evt);
+ }
+ });
+
+ btnSalvarItemAdicao.setBackground(new java.awt.Color(51, 255, 0));
+ btnSalvarItemAdicao.setFont(new java.awt.Font("Old London", 1, 24)); // NOI18N
+ btnSalvarItemAdicao.setText("Salvar");
+ btnSalvarItemAdicao.setToolTipText("salvar os dados");
+ btnSalvarItemAdicao.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSalvarItemAdicaoActionPerformed(evt);
+ }
+ });
+
+ btnPesquisarItem1.setBackground(new java.awt.Color(153, 153, 255));
+ btnPesquisarItem1.setFont(new java.awt.Font("Old London", 1, 24)); // NOI18N
+ btnPesquisarItem1.setText("Pesquisar");
+ btnPesquisarItem1.setToolTipText("pesquisar por título");
+ btnPesquisarItem1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnPesquisarItem1ActionPerformed(evt);
+ }
+ });
+
+ btnCancelarItemAdicao.setBackground(new java.awt.Color(255, 0, 0));
+ btnCancelarItemAdicao.setFont(new java.awt.Font("Old London", 1, 24)); // NOI18N
+ btnCancelarItemAdicao.setText("Cancelar");
+ btnCancelarItemAdicao.setToolTipText("cancelar operação");
+ btnCancelarItemAdicao.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelarItemAdicaoActionPerformed(evt);
+ }
+ });
+
+ btnExcluirItemAdicao.setBackground(new java.awt.Color(153, 153, 153));
+ btnExcluirItemAdicao.setFont(new java.awt.Font("Old London", 1, 24)); // NOI18N
+ btnExcluirItemAdicao.setText("Excluir");
+ btnExcluirItemAdicao.setToolTipText("Excluir algum produto do estoque");
+ btnExcluirItemAdicao.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnExcluirItemAdicaoActionPerformed(evt);
+ }
+ });
+
+ lblControleAdicao.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
+ lblControleAdicao.setText("Controle do estoque - Adição/Remoção de item");
+
+ lblTituloAdicao.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ lblTituloAdicao.setText("Titulo");
+
+ lblCodigoProdutoAdicao.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ lblCodigoProdutoAdicao.setText("Codigo de Produto");
+
+ btnBuscarAdicao.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ btnBuscarAdicao.setText("Buscar");
+ btnBuscarAdicao.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnBuscarAdicaoActionPerformed(evt);
+ }
+ });
+
+ lblAutorAdicao.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ lblAutorAdicao.setText("Autor");
+
+ javax.swing.GroupLayout jPanelAdicaoItemLayout = new javax.swing.GroupLayout(jPanelAdicaoItem);
+ jPanelAdicaoItem.setLayout(jPanelAdicaoItemLayout);
+ jPanelAdicaoItemLayout.setHorizontalGroup(
+ jPanelAdicaoItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelAdicaoItemLayout.createSequentialGroup()
+ .addGap(195, 195, 195)
+ .addComponent(lblControleAdicao)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanelAdicaoItemLayout.createSequentialGroup()
+ .addGap(15, 15, 15)
+ .addGroup(jPanelAdicaoItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(btnCriar1)
+ .addGroup(jPanelAdicaoItemLayout.createSequentialGroup()
+ .addComponent(lblTituloAdicao)
+ .addGap(18, 18, 18)
+ .addComponent(txtTituloAdicao, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(18, 18, 18)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(jPanelAdicaoItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelAdicaoItemLayout.createSequentialGroup()
+ .addComponent(btnSalvarItemAdicao)
+ .addGap(117, 117, 117)
+ .addComponent(btnCancelarItemAdicao)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 61, Short.MAX_VALUE)
+ .addComponent(btnExcluirItemAdicao)
+ .addGap(58, 58, 58)
+ .addComponent(btnPesquisarItem1))
+ .addGroup(jPanelAdicaoItemLayout.createSequentialGroup()
+ .addComponent(lblAutorAdicao, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(37, 37, 37)
+ .addComponent(txtAutorAdicao)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(lblCodigoProdutoAdicao)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(txtCodigoProdutoAdicao, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(18, 18, 18)
+ .addComponent(btnBuscarAdicao, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGap(24, 24, 24))
+ .addGroup(jPanelAdicaoItemLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jScrollPane3)
+ .addContainerGap())
+ );
+ jPanelAdicaoItemLayout.setVerticalGroup(
+ jPanelAdicaoItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelAdicaoItemLayout.createSequentialGroup()
+ .addComponent(lblControleAdicao, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanelAdicaoItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelAdicaoItemLayout.createSequentialGroup()
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanelAdicaoItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelAdicaoItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblCodigoProdutoAdicao, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblAutorAdicao, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(txtAutorAdicao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanelAdicaoItemLayout.createSequentialGroup()
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 9, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanelAdicaoItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(btnBuscarAdicao, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanelAdicaoItemLayout.createSequentialGroup()
+ .addComponent(txtCodigoProdutoAdicao)
+ .addGap(9, 9, 9))))
+ .addComponent(lblTituloAdicao, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGroup(jPanelAdicaoItemLayout.createSequentialGroup()
+ .addGap(16, 16, 16)
+ .addComponent(txtTituloAdicao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGap(40, 40, 40)
+ .addGroup(jPanelAdicaoItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnCriar1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnSalvarItemAdicao, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnCancelarItemAdicao, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnExcluirItemAdicao, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnPesquisarItem1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 332, Short.MAX_VALUE)
+ .addContainerGap())
);
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 960, Short.MAX_VALUE)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addContainerGap(10, Short.MAX_VALUE)
+ .addComponent(jPanelAdicaoItem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(10, Short.MAX_VALUE)))
+ );
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 590, Short.MAX_VALUE)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jPanelAdicaoItem, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
+ );
+
+ getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(940, 150, 960, 590));
+
+ jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Telas/ControleEstoque.png"))); // NOI18N
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1930, -1));
+
pack();
}// //GEN-END:initComponents
@@ -332,13 +773,30 @@ private void btnCancelarItemActionPerformed(java.awt.event.ActionEvent evt) {//G
disableEstoqueFields();
disableEstoqueButtons();
//btnAddItem.setEnabled(true);
+ carregarCamposProduto();
+ tblMostraProdutos.clearSelection();
btnPesquisarItem.setEnabled(true);
+ txtGeneroEstoque.setEnabled(false);
}//GEN-LAST:event_btnCancelarItemActionPerformed
private void btnSalvarItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarItemActionPerformed
// TODO add your handling code here:
disableEstoqueFields();
disableEstoqueButtons();
+ txtCodigoEstoque.setEnabled(false);
+ int index = tblMostraProdutos.getSelectedRow();
+ Produto produto = estoque.get(index);
+ produto.setTitulo(txtTituloEstoque.getText());
+ produto.setPreço(Double.parseDouble(txtPrecoEstoque.getText()));
+ produto.setCodigoDoProduto(txtCodigoEstoque.getText());
+ produto.setAutor(txtAutor.getText());
+ produto.setQuantidadeEstoque(Integer.parseInt(txtQuantiaEstoque.getText()));
+ produto.setCodigoDoProduto(txtCodigoEstoque.getText());
+ produto.setDescrição(txtDescricaoEstoque.getText());
+ produto.setGenero(txtGeneroEstoque.getText());
+
+ carregarTabelaProdutos();
+ carregarTabelaProdutosAdicao();
//btnAddItem.setEnabled(true);
btnPesquisarItem.setEnabled(true);
}//GEN-LAST:event_btnSalvarItemActionPerformed
@@ -347,17 +805,271 @@ private void btnPesquisarItemActionPerformed(java.awt.event.ActionEvent evt) {//
// TODO add your handling code here:
disableEstoqueFields();
disableEstoqueButtons();
+ clearEstoqueFields();
btnCancelarItem.setEnabled(true);
lblTituloEstoque.setEnabled(true);
txtTituloEstoque.setEnabled(true);
+ txtGeneroEstoque.setEnabled(true);
+ txtAutor.setEnabled(true);
+ lblAutor.setEnabled(true);
+ txtCodigoEstoque.setEnabled(true);
+ lblCodigoEstoque.setEnabled(true);
+ lblGeneroEstoque.setEnabled(true);
btnBuscar.setEnabled(true);
txtTituloEstoque.requestFocus();
+
}//GEN-LAST:event_btnPesquisarItemActionPerformed
private void btnAlterarItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAlterarItemActionPerformed
// TODO add your handling code here:
+ btnSalvarItem.setEnabled(true);
+ enableEstoqueFields();
+ txtCodigoEstoque.setEnabled(true);
+ txtAutor.setEnabled(true);
+ lblAutor.setEnabled(true);
+ txtGeneroEstoque.setEnabled(true);
+ lblGeneroEstoque.setEnabled(true);
+
}//GEN-LAST:event_btnAlterarItemActionPerformed
+ private void tblMostraProdutosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblMostraProdutosMouseClicked
+ // TODO add your handling code here:
+ btnAlterarItem.setEnabled(true);
+ btnCancelarItem.setEnabled(true);
+ //btnExcluirItem.setEnabled(true);
+ carregarCamposProduto();
+ }//GEN-LAST:event_tblMostraProdutosMouseClicked
+
+ private void tblMostraProdutosAdicaoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblMostraProdutosAdicaoMouseClicked
+ // TODO add your handling code here:
+ btnExcluirItemAdicao.setEnabled(true);
+ btnCancelarItemAdicao.setEnabled(true);
+ int i = tblMostraProdutosAdicao.getSelectedRow();
+ int row = tblMostraProdutosAdicao.getSelectedRow();
+ int column = tblMostraProdutosAdicao.getSelectedColumn();
+ Object produtoPesquisado = tblMostraProdutosAdicao.getValueAt(row,0);
+ System.out.println("Value selected at: "+produtoPesquisado);
+ for (Produto item : estoque) {
+ if (item.getTitulo().equals(produtoPesquisado)) {
+ // Use the matched Produto item directly
+ txtTituloAdicao.setText(item.getTitulo());
+ txtAutorAdicao.setText(item.getAutor());
+ txtCodigoProdutoAdicao.setText(item.getCodigoDoProduto());
+
+ // Break the loop as you have found the item
+ break;
+ }
+ }
+ Produto produtoPegado = (Produto)produtoPesquisado;
+ String inputBusca = String.valueOf(produtoPesquisado);
+ System.out.println("Item do inputBusca a ser aparecido na caixa de texto"+inputBusca);
+
+ }//GEN-LAST:event_tblMostraProdutosAdicaoMouseClicked
+
+ private void btnCriar1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCriar1ActionPerformed
+ // TODO add your handling code here:
+ cadastrosFlag="criarItem";
+ new cadastros().setVisible(true);
+ btnSalvarItemAdicao.setEnabled(true);
+
+ lblTituloEstoque.setEnabled(true);
+ }//GEN-LAST:event_btnCriar1ActionPerformed
+
+ private void btnSalvarItemAdicaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarItemAdicaoActionPerformed
+ // TODO add your handling code here:
+
+ carregarTabelaProdutosAdicao();
+ carregarTabelaProdutos();
+ }//GEN-LAST:event_btnSalvarItemAdicaoActionPerformed
+
+ private void btnPesquisarItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPesquisarItem1ActionPerformed
+ // TODO add your handling code here:
+ enableEstoqueAdicaoFields();
+ clearControleAdicao();
+ }//GEN-LAST:event_btnPesquisarItem1ActionPerformed
+
+ private void btnCancelarItemAdicaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarItemAdicaoActionPerformed
+ // TODO add your handling code here:
+ tblMostraProdutosAdicao.clearSelection();
+ }//GEN-LAST:event_btnCancelarItemAdicaoActionPerformed
+
+ private void btnExcluirItemAdicaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirItemAdicaoActionPerformed
+ // TODO add your handling code here:
+ int index = tblMostraProdutosAdicao.getSelectedRow();
+
+ // Ensure that a row is selected
+ if (index == -1) {
+ // Handle the case where no row is selected (optional)
+ JOptionPane.showMessageDialog(this, "Please select a product to remove.");
+ return;
+ }
+
+ // Retrieve the product title from the selected row
+ Object itemPesquisado = tblMostraProdutosAdicao.getValueAt(index, 0);
+ String inputBusca = String.valueOf(itemPesquisado);
+
+ // Search for the item in the stock and remove it
+ for (Produto itemEstoque : estoque) {
+ if (itemEstoque.getTitulo().equals(inputBusca)) {
+ estoque.remove(itemEstoque);
+ break; // Exit the loop after removing the item
+ }
+ }
+ carregarTabelaProdutosAdicao();
+ carregarTabelaProdutos();
+
+
+ }//GEN-LAST:event_btnExcluirItemAdicaoActionPerformed
+
+ private void btnSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSairActionPerformed
+ // TODO add your handling code here:
+ this.setVisible(false);
+ }//GEN-LAST:event_btnSairActionPerformed
+
+ private void btnBuscarAdicaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarAdicaoActionPerformed
+ // TODO add your handling code here:
+ String tituloPesquisado = txtTituloAdicao.getText().toLowerCase().trim();
+ String autorPesquisado = txtAutorAdicao.getText().toLowerCase().trim();
+ String numCodigoPesquisado = txtCodigoProdutoAdicao.getText().toLowerCase().trim();
+ String tituloPesquisadoPuro = txtTituloAdicao.getText();
+ String autorPesquisadoPuro = txtAutorAdicao.getText();
+ String numCodigoPesquisadoPuro = txtCodigoProdutoAdicao.getText();
+ if (tituloPesquisado.isEmpty()&& autorPesquisado.isEmpty()&&numCodigoPesquisado.isEmpty()) {
+ JOptionPane.showMessageDialog(this, "Por favor, insira um título ou autor ou código de produto para pesquisar.", "Aviso", JOptionPane.WARNING_MESSAGE);
+ carregarTabelaProdutosAdicao();
+ return;
+ }
+
+
+ DefaultTableModel modeloTabelaProdutos = new DefaultTableModel(new Object[] {"Titulo", "Autor", "Gênero", "Valor", "Quant.Estoque"}, 0);
+
+ boolean produtoEncontrado = false;
+
+ boolean tituloVazio = tituloPesquisado.isBlank();
+ boolean autorVazio = autorPesquisado.isBlank();
+ boolean codigoVazio = numCodigoPesquisado.isBlank();
+ for (Produto produto : estoque) {
+ if (produto != null && produto.getTitulo() != null && produto.getAutor() != null) {
+ boolean matchesTitle = tituloPesquisado.isBlank() || produto.getTitulo().toLowerCase().contains(tituloPesquisado);
+ boolean matchesAuthor = autorPesquisado.isBlank() || produto.getAutor().toLowerCase().contains(autorPesquisado);
+ boolean matchesCodigo = numCodigoPesquisado.isBlank() || produto.getCodigoDoProduto().toLowerCase().contains(numCodigoPesquisado);
+
+ if (matchesTitle && matchesAuthor && matchesCodigo) {
+ Object novalinha[] = new Object[]{
+ produto.getTitulo(),
+ produto.getAutor(),
+ produto.getGenero(),
+ produto.getPreço(),
+ produto.getQuantidadeEstoque()
+ };
+ modeloTabelaProdutos.addRow(novalinha);
+ produtoEncontrado = true;
+ }
+ }
+ }
+if (produtoEncontrado) {
+ tblMostraProdutosAdicao.setModel(modeloTabelaProdutos);
+ // Ajusta a largura das colunas
+ tblMostraProdutosAdicao.getColumnModel().getColumn(0).setPreferredWidth(100);
+ tblMostraProdutosAdicao.getColumnModel().getColumn(1).setPreferredWidth(50);
+ tblMostraProdutosAdicao.getColumnModel().getColumn(2).setPreferredWidth(14);
+ tblMostraProdutosAdicao.getColumnModel().getColumn(3).setPreferredWidth(8);
+ tblMostraProdutosAdicao.getColumnModel().getColumn(4).setPreferredWidth(3);
+}else{
+ if(autorPesquisado.isEmpty()){
+ JOptionPane.showMessageDialog(this, "Nenhum produto encontrado com o título: " + tituloPesquisadoPuro, "Resultado da pesquisa", JOptionPane.INFORMATION_MESSAGE);
+ carregarTabelaProdutosAdicao(); // Load all products if no matches found
+ }
+ if(tituloPesquisado.isEmpty()){
+ JOptionPane.showMessageDialog(this, "Nenhum produto encontrado com o autor: " + autorPesquisadoPuro, "Resultado da pesquisa", JOptionPane.INFORMATION_MESSAGE);
+ carregarTabelaProdutosAdicao();
+ }
+ if((!tituloPesquisado.isEmpty())&&(!autorPesquisado.isEmpty())){
+ JOptionPane.showMessageDialog(this, "Nenhum produto encontrado com o título: " + tituloPesquisadoPuro +" e autor: "+autorPesquisadoPuro, "Resultado da pesquisa", JOptionPane.INFORMATION_MESSAGE);
+ carregarTabelaProdutosAdicao();
+ }
+
+}
+ }//GEN-LAST:event_btnBuscarAdicaoActionPerformed
+
+ private void txtPrecoEstoqueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtPrecoEstoqueActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_txtPrecoEstoqueActionPerformed
+
+ private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed
+ // TODO add your handling code here:
+ txtPrecoEstoque.setEnabled(false);
+ txtQuantiaEstoque.setEnabled(false);
+ txtDescricaoEstoque.setEnabled(false);
+
+ String tituloPesquisado = txtTituloEstoque.getText().toLowerCase().trim();
+ String autorPesquisado = txtAutor.getText().toLowerCase().trim();
+ String numCodigoPesquisado = txtCodigoEstoque.getText().toLowerCase().trim();
+ String tituloPesquisadoPuro = txtTituloEstoque.getText();
+ String autorPesquisadoPuro = txtAutor.getText();
+ String numCodigoPesquisadoPuro = txtCodigoEstoque.getText();
+ if (tituloPesquisado.isEmpty()&& autorPesquisado.isEmpty()&&numCodigoPesquisado.isEmpty()) {
+ JOptionPane.showMessageDialog(this, "Por favor, insira um título ou autor ou código de produto para pesquisar.", "Aviso", JOptionPane.WARNING_MESSAGE);
+ carregarTabelaProdutos();
+ return;
+ }
+
+
+ DefaultTableModel modeloTabelaProdutos = new DefaultTableModel(new Object[] {"Titulo", "Autor", "Gênero", "Valor", "Quant.Estoque"}, 0);
+
+ boolean produtoEncontrado = false;
+
+ boolean tituloVazio = tituloPesquisado.isBlank();
+ boolean autorVazio = autorPesquisado.isBlank();
+ boolean codigoVazio = numCodigoPesquisado.isBlank();
+ for (Produto produto : estoque) {
+ if (produto != null && produto.getTitulo() != null && produto.getAutor() != null) {
+ boolean matchesTitle = tituloPesquisado.isBlank() || produto.getTitulo().toLowerCase().contains(tituloPesquisado);
+ boolean matchesAuthor = autorPesquisado.isBlank() || produto.getAutor().toLowerCase().contains(autorPesquisado);
+ boolean matchesCodigo = numCodigoPesquisado.isBlank() || produto.getCodigoDoProduto().toLowerCase().contains(numCodigoPesquisado);
+
+ if (matchesTitle && matchesAuthor && matchesCodigo) {
+ Object novalinha[] = new Object[]{
+ produto.getTitulo(),
+ produto.getAutor(),
+ produto.getGenero(),
+ produto.getPreço(),
+ produto.getQuantidadeEstoque()
+ };
+ modeloTabelaProdutos.addRow(novalinha);
+ produtoEncontrado = true;
+ }
+ }
+ }
+if (produtoEncontrado) {
+ tblMostraProdutos.setModel(modeloTabelaProdutos);
+ // Ajusta a largura das colunas
+ tblMostraProdutos.getColumnModel().getColumn(0).setPreferredWidth(100);
+ tblMostraProdutos.getColumnModel().getColumn(1).setPreferredWidth(50);
+ tblMostraProdutos.getColumnModel().getColumn(2).setPreferredWidth(14);
+ tblMostraProdutos.getColumnModel().getColumn(3).setPreferredWidth(8);
+ tblMostraProdutos.getColumnModel().getColumn(4).setPreferredWidth(3);
+}else{
+ if(autorPesquisado.isEmpty()&&numCodigoPesquisado.isEmpty()){
+ JOptionPane.showMessageDialog(this, "Nenhum produto encontrado com o título: " + tituloPesquisadoPuro, "Resultado da pesquisa", JOptionPane.INFORMATION_MESSAGE);
+ carregarTabelaProdutos(); // Load all products if no matches found
+ }
+ if((tituloPesquisado.isEmpty()&&numCodigoPesquisado.isEmpty())){
+ JOptionPane.showMessageDialog(this, "Nenhum produto encontrado com o autor: " + autorPesquisadoPuro, "Resultado da pesquisa", JOptionPane.INFORMATION_MESSAGE);
+ carregarTabelaProdutos();
+ }
+ if((tituloPesquisado.isEmpty()&&autorPesquisado.isEmpty())){
+ JOptionPane.showMessageDialog(this, "Nenhum produto encontrado com o código: " + numCodigoPesquisadoPuro, "Resultado da pesquisa", JOptionPane.INFORMATION_MESSAGE);
+ carregarTabelaProdutos();
+ }
+ if((!tituloPesquisado.isEmpty())&&(!autorPesquisado.isEmpty())){
+ JOptionPane.showMessageDialog(this, "Nenhum produto encontrado com o título: " + tituloPesquisadoPuro +" e autor: "+autorPesquisadoPuro, "Resultado da pesquisa", JOptionPane.INFORMATION_MESSAGE);
+ carregarTabelaProdutos();
+ }
+
+}
+ }//GEN-LAST:event_btnBuscarActionPerformed
+
/**
* @param args the command line arguments
*/
@@ -396,24 +1108,47 @@ public void run() {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnAlterarItem;
private javax.swing.JButton btnBuscar;
+ private javax.swing.JButton btnBuscarAdicao;
private javax.swing.JButton btnCancelarItem;
- private javax.swing.JButton btnExcluirItem;
+ private javax.swing.JButton btnCancelarItemAdicao;
+ private javax.swing.JButton btnCriar1;
+ private javax.swing.JButton btnExcluirItemAdicao;
private javax.swing.JButton btnPesquisarItem;
+ private javax.swing.JButton btnPesquisarItem1;
+ private javax.swing.JButton btnSair;
private javax.swing.JButton btnSalvarItem;
- private javax.swing.JButton jButton1;
+ private javax.swing.JButton btnSalvarItemAdicao;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
+ private javax.swing.JPanel jPanelAdicaoItem;
+ private javax.swing.JPanel jPanelAlterarItem;
private javax.swing.JScrollPane jScrollPane1;
- private javax.swing.JTable jTable1;
+ private javax.swing.JScrollPane jScrollPane2;
+ private javax.swing.JScrollPane jScrollPane3;
+ private javax.swing.JLabel lblAutor;
+ private javax.swing.JLabel lblAutorAdicao;
private javax.swing.JLabel lblCodigoEstoque;
+ private javax.swing.JLabel lblCodigoProdutoAdicao;
+ private javax.swing.JLabel lblControleAdicao;
private javax.swing.JLabel lblControleEstoque;
private javax.swing.JLabel lblDescricaoEstoque;
+ private javax.swing.JLabel lblGeneroEstoque;
private javax.swing.JLabel lblPrecoEstoque;
private javax.swing.JLabel lblQuantiaEstoque;
+ private javax.swing.JLabel lblTituloAdicao;
private javax.swing.JLabel lblTituloEstoque;
+ private javax.swing.JTable tblMostraProdutos;
+ private javax.swing.JTable tblMostraProdutosAdicao;
+ private javax.swing.JTextField txtAutor;
+ private javax.swing.JTextField txtAutorAdicao;
private javax.swing.JTextField txtCodigoEstoque;
- private javax.swing.JTextField txtDescricaoEstoque;
+ private javax.swing.JTextField txtCodigoProdutoAdicao;
+ private javax.swing.JTextArea txtDescricaoEstoque;
+ private javax.swing.JTextField txtGeneroEstoque;
private javax.swing.JTextField txtPrecoEstoque;
private javax.swing.JTextField txtQuantiaEstoque;
+ private javax.swing.JTextField txtTituloAdicao;
private javax.swing.JTextField txtTituloEstoque;
// End of variables declaration//GEN-END:variables
}
diff --git a/src/telas/CriarNovoProduto.form b/src/telas/CriarNovoProduto.form
new file mode 100644
index 0000000..59592ba
--- /dev/null
+++ b/src/telas/CriarNovoProduto.form
@@ -0,0 +1,251 @@
+
+
+
diff --git a/src/telas/CriarNovoProduto.java b/src/telas/CriarNovoProduto.java
new file mode 100644
index 0000000..ffacbc6
--- /dev/null
+++ b/src/telas/CriarNovoProduto.java
@@ -0,0 +1,290 @@
+/*
+ * 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 telas;
+
+import static classes.Estoque.estoque;
+import classes.Produto;
+import javax.swing.JOptionPane;
+
+/**
+ *
+ * @author Yuri
+ */
+public class CriarNovoProduto extends javax.swing.JFrame {
+
+ /**
+ * Creates new form CriarNovoProduto
+ */
+ public CriarNovoProduto() {
+ 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jPanel1 = new javax.swing.JPanel();
+ jLabel1 = new javax.swing.JLabel();
+ jLabel2 = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+ jLabel4 = new javax.swing.JLabel();
+ jLabel5 = new javax.swing.JLabel();
+ jLabel6 = new javax.swing.JLabel();
+ jLabel7 = new javax.swing.JLabel();
+ txtTitulo = new javax.swing.JTextField();
+ txtAutor = new javax.swing.JTextField();
+ txtGenero = new javax.swing.JTextField();
+ txtPreco = new javax.swing.JTextField();
+ txtQuantiaEstoque = new javax.swing.JTextField();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ txtAreaDescricao = new javax.swing.JTextArea();
+ btnCriarNovoItem = new javax.swing.JButton();
+ btnCancelar = new javax.swing.JButton();
+ jLabel8 = new javax.swing.JLabel();
+ txtCodigoProduto = new javax.swing.JTextField();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+
+ jLabel1.setText("Criar novo Produto no sistema");
+
+ jLabel2.setText("Título");
+
+ jLabel3.setText("Autor");
+
+ jLabel4.setText("Gênero");
+
+ jLabel5.setText("Preço");
+
+ jLabel6.setText("Quantidade Estoque");
+
+ jLabel7.setText("Descrição");
+
+ txtTitulo.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ txtTituloActionPerformed(evt);
+ }
+ });
+
+ txtAreaDescricao.setColumns(20);
+ txtAreaDescricao.setRows(5);
+ jScrollPane1.setViewportView(txtAreaDescricao);
+
+ btnCriarNovoItem.setText("Criar novo Item");
+ btnCriarNovoItem.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCriarNovoItemActionPerformed(evt);
+ }
+ });
+
+ btnCancelar.setText("Cancelar");
+ btnCancelar.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelarActionPerformed(evt);
+ }
+ });
+
+ jLabel8.setText("Código Produto");
+ jLabel8.setToolTipText("");
+
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 907, Short.MAX_VALUE)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(468, 468, 468)
+ .addComponent(jLabel1))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(jLabel3)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(txtAutor, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(jLabel2)
+ .addGap(29, 29, 29)
+ .addComponent(txtTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addComponent(jLabel4)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(btnCriarNovoItem)
+ .addComponent(txtGenero, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE))))
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(jLabel5)
+ .addGap(97, 97, 97)
+ .addComponent(txtPreco, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(18, 18, 18)
+ .addComponent(jLabel8)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtCodigoProduto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel6)
+ .addComponent(jLabel7))
+ .addGap(18, 18, 18)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(txtQuantiaEstoque, javax.swing.GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE)))))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(195, 195, 195)
+ .addComponent(btnCancelar)))))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
+ );
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 301, Short.MAX_VALUE)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel1)
+ .addGap(18, 18, 18)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel2)
+ .addComponent(jLabel5)
+ .addComponent(txtTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(txtPreco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jLabel8)
+ .addComponent(txtCodigoProduto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(25, 25, 25)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel3)
+ .addComponent(jLabel6)
+ .addComponent(txtAutor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(txtQuantiaEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(45, 45, 45)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel4)
+ .addComponent(jLabel7)
+ .addComponent(txtGenero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(32, 32, 32)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnCriarNovoItem)
+ .addComponent(btnCancelar))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
+ );
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(251, Short.MAX_VALUE))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(350, Short.MAX_VALUE))
+ );
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void txtTituloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtTituloActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_txtTituloActionPerformed
+
+ private void btnCriarNovoItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCriarNovoItemActionPerformed
+ // TODO add your handling code here:
+
+ String titulo = txtTitulo.getText();
+ String autor = txtAutor.getText();
+ String genero = txtGenero.getText();
+ double preco = Double.parseDouble(txtPreco.getText());
+ int qntEstoque = Integer.parseInt(txtQuantiaEstoque.getText());
+ String codigoProduto = txtCodigoProduto.getText();
+ String descricao = txtAreaDescricao.getText();
+
+ Produto produto1 = new Produto(titulo,autor,genero,preco,qntEstoque,codigoProduto,descricao);
+
+ estoque.add(produto1);
+ JOptionPane.showMessageDialog(null,"Item cadastrado com sucesso!", "Novo produto criado!",JOptionPane.PLAIN_MESSAGE);
+ this.setVisible(false);
+
+
+
+ }//GEN-LAST:event_btnCriarNovoItemActionPerformed
+
+ private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
+ // TODO add your handling code here:
+ this.setVisible(false);
+ }//GEN-LAST:event_btnCancelarActionPerformed
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ /* Set the Nimbus look and feel */
+ //
+ /* 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(CriarNovoProduto.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (InstantiationException ex) {
+ java.util.logging.Logger.getLogger(CriarNovoProduto.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ java.util.logging.Logger.getLogger(CriarNovoProduto.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+ java.util.logging.Logger.getLogger(CriarNovoProduto.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ }
+ //
+
+ /* Create and display the form */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new CriarNovoProduto().setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnCancelar;
+ private javax.swing.JButton btnCriarNovoItem;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JLabel jLabel6;
+ private javax.swing.JLabel jLabel7;
+ private javax.swing.JLabel jLabel8;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JTextArea txtAreaDescricao;
+ private javax.swing.JTextField txtAutor;
+ private javax.swing.JTextField txtCodigoProduto;
+ private javax.swing.JTextField txtGenero;
+ private javax.swing.JTextField txtPreco;
+ private javax.swing.JTextField txtQuantiaEstoque;
+ private javax.swing.JTextField txtTitulo;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/src/telas/Menu.form b/src/telas/Menu.form
index b2c096d..acbed56 100644
--- a/src/telas/Menu.form
+++ b/src/telas/Menu.form
@@ -17,7 +17,7 @@
-
+
@@ -39,15 +39,12 @@
-
-
-
-
+
-
+
@@ -61,146 +58,137 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
+
-
+
-
+
+
-
+
-
+
+
-
+
-
+
+
-
+
-
+
-
+
+
-
+
-
+
-
+
+
-
+
-
+
-
+
+
-
+
@@ -223,7 +211,7 @@
-
+
@@ -246,47 +234,56 @@
-
+
-
+
-
-
+
+
-
-
+
+
-
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
+
+
+
-
+
diff --git a/src/telas/Menu.java b/src/telas/Menu.java
index c5fe0d7..583475e 100644
--- a/src/telas/Menu.java
+++ b/src/telas/Menu.java
@@ -6,11 +6,17 @@
import classes.Cliente;
import static classes.Cliente.listaClientes;
+import classes.Estoque;
+import static classes.Estoque.estoque;
import classes.Funcionario;
import static classes.Funcionario.listaFuncionarios;
import classes.Gerente;
+import classes.Produto;
+import static classes.Usuario.logado;
+import static classes.Usuario.user;
import javax.swing.JOptionPane;
import static telas.cadastarGerente.listaGerente;
+import static telas.cadastros.cadastrosFlag;
//import static telas.cadastrarCliente.listaClientes;
//import static telas.cadastrarFuncionario.listaFuncionarios;
@@ -22,9 +28,127 @@
public class Menu extends javax.swing.JFrame {
- static boolean logado = false;
- static String user;// 'gerente','funcionario','cliente'
- public void verificarLogin(boolean logado){
+ //static boolean logado = false;
+ //static String user="anonimo";// 'gerente','funcionario','cliente'
+ Estoque estoqueLoja = new Estoque();
+ public static int historicoCarrinhosTotais = 0;
+
+
+
+ /**
+ * Creates new form Menu
+ */
+ public Menu() {
+ initComponents();
+ System.out.println("logado:"+logado);
+ System.out.println("user:"+user);
+ setLocationRelativeTo(null);
+ this.setExtendedState(MAXIMIZED_BOTH);
+ verificarLogin(logado, user);
+ criarContasIniciais();
+ atualizarBotoes();
+ }
+ /**
+ * 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")
+ public void criarContasIniciais(){
+ if(listaFuncionarios.size()==0 & listaClientes.size()==0 & estoque.size()==0){
+ Gerente gerente;
+ gerente = new Gerente("admin","000.000.000-00","admin@gmail.com","admin");
+ listaGerente.add(gerente);
+ Funcionario funcionario;
+ funcionario = new Funcionario("func","000.000.000-00","func@gmail.com","func");
+ listaFuncionarios.add(funcionario);
+ Funcionario funcionario1= new Funcionario("Carlos","111.111.111-11","carlos@gmail.com","carlos");
+ listaFuncionarios.add(funcionario1);
+ Funcionario funcionario10 = new Funcionario("Ana", "222.222.222-22", "ana@gmail.com", "ana123");
+ listaFuncionarios.add(funcionario10);
+
+ Funcionario funcionario2 = new Funcionario("Bruno", "333.333.333-33", "bruno@gmail.com", "bruno123");
+ listaFuncionarios.add(funcionario2);
+
+ Funcionario funcionario3 = new Funcionario("Camila", "444.444.444-44", "camila@gmail.com", "camila123");
+ listaFuncionarios.add(funcionario3);
+
+ Funcionario funcionario4 = new Funcionario("Diego", "555.555.555-55", "diego@gmail.com", "diego123");
+ listaFuncionarios.add(funcionario4);
+
+ Funcionario funcionario5 = new Funcionario("Elisa", "666.666.666-66", "elisa@gmail.com", "elisa123");
+ listaFuncionarios.add(funcionario5);
+ Cliente cliente = new Cliente("user","000.000.000-00","user@gmail.com","user","Pernambuco","10/05/1990","99999-9999");
+ listaClientes.add(cliente);
+ Cliente cliente1 = new Cliente("Alberto","010.034.123-00","alberto@gmail.com","alberto","Brasília","15/12/2000","88888-8888");
+ listaClientes.add(cliente1);
+ Cliente cliente10 = new Cliente("Alice", "777.777.777-77", "alice@gmail.com", "alice123", "Rua A, 123", "01/01/1985", "(11) 98765-4321");
+ listaClientes.add(cliente10);
+
+ Cliente cliente2 = new Cliente("Bernardo", "888.888.888-88", "bernardo@gmail.com", "bernardo123", "Avenida B, 456", "02/02/1990", "(21) 99876-5432");
+ listaClientes.add(cliente2);
+
+ Cliente cliente3 = new Cliente("Cecília", "999.999.999-99", "cecilia@gmail.com", "cecilia123", "Praça C, 789", "03/03/1995", "(31) 90987-6543");
+ listaClientes.add(cliente3);
+
+ Cliente cliente4 = new Cliente("Daniel", "000.000.000-00", "daniel@gmail.com", "daniel123", "Travessa D, 101", "04/04/1980", "(41) 91234-5678");
+ listaClientes.add(cliente4);
+
+ Cliente cliente5 = new Cliente("Eva", "111.111.111-11", "eva@gmail.com", "eva123", "Rua E, 202", "05/05/1988", "(51) 92345-6789");
+ listaClientes.add(cliente5);
+
+
+ Produto produto1 = new Produto("Eragon","Christopher Paolini","Aventura",15.69,3,"1","Eragon se torna um cavaleiro de Dragão");
+ estoqueLoja.addEstoque(produto1);
+ Produto produto2 = new Produto("Diario de um banana","Jeff Kiney","Comédia",10.40,5,"2","Diário de Greg Heffley");
+ estoqueLoja.addEstoque(produto2);
+ Produto produto3 = new Produto("Eldest","Christopher Paolini","Aventura",20.69,6,"3","Eragon e Murtagh lutam na campina ardente");
+ estoqueLoja.addEstoque(produto3);
+ Produto produto4 = new Produto("Brisingr","Christopher Paolini","Aventura",18.29,6,"4","Eragon treina com Oromis");
+ estoqueLoja.addEstoque(produto4);
+ Produto produto5 = new Produto("Herança","Christopher Paolini","Aventura",24.89,6,"5","Eragon luta contra o Rei Galbatorix");
+ estoqueLoja.addEstoque(produto5);
+ Produto produto6 = new Produto("O Senhor dos Anéis: A Sociedade do Anel", "J.R.R. Tolkien", "Fantasia", 29.99, 4, "6", "A primeira parte da épica trilogia de O Senhor dos Anéis");
+ estoqueLoja.addEstoque(produto6);
+
+ Produto produto7 = new Produto("O Hobbit", "J.R.R. Tolkien", "Fantasia", 19.99, 7, "7", "A jornada de Bilbo Bolseiro até a Montanha Solitária");
+ estoqueLoja.addEstoque(produto7);
+
+ Produto produto8 = new Produto("1984", "George Orwell", "Ficção Distópica", 22.50, 10, "8", "Uma visão perturbadora de um futuro totalitário");
+ estoqueLoja.addEstoque(produto8);
+
+ Produto produto9 = new Produto("A Revolução dos Bichos", "George Orwell", "Fábula Política", 14.90, 8, "9", "Uma sátira ao regime soviético");
+ estoqueLoja.addEstoque(produto9);
+
+ Produto produto10 = new Produto("Harry Potter e a Pedra Filosofal", "J.K. Rowling", "Fantasia", 35.00, 12, "10", "O início da jornada mágica de Harry Potter");
+ estoqueLoja.addEstoque(produto10);
+
+ Produto produto11 = new Produto("O Código Da Vinci", "Dan Brown", "Suspense", 25.99, 9, "11", "Robert Langdon desvenda segredos antigos em uma trama cheia de mistério");
+ estoqueLoja.addEstoque(produto11);
+
+ Produto produto12 = new Produto("Orgulho e Preconceito", "Jane Austen", "Romance", 17.99, 5, "12", "Uma crítica à sociedade inglesa do século XIX através de uma história de amor");
+ estoqueLoja.addEstoque(produto12);
+
+ Produto produto13 = new Produto("A Arte da Guerra", "Sun Tzu", "Estratégia", 12.80, 15, "13", "Um clássico sobre estratégias militares e de liderança");
+ estoqueLoja.addEstoque(produto13);
+
+ Produto produto14 = new Produto("O Pequeno Príncipe", "Antoine de Saint-Exupéry", "Infantil", 18.50, 10, "14", "Uma fábula sobre amor, perda e amizade");
+ estoqueLoja.addEstoque(produto14);
+
+ Produto produto15 = new Produto("O Nome do Vento", "Patrick Rothfuss", "Fantasia", 28.00, 6, "15", "A história de Kvothe, um mago lendário");
+ estoqueLoja.addEstoque(produto15);
+
+ Produto produto16 = new Produto("Bleach:TYBW","Tite Kubo","Ação",32.00,10,"16","Yhwach, o rei Quincy selado há 1000 anos recupera seu poder e ataca a Soul Society");
+ estoqueLoja.addEstoque(produto16);
+
+ Produto produto17 = new Produto("Bleach: Arrankar","Tite Kubo","Fantasia",30.00,12,"17","Aizen cria os Espadas e domina o Hueco Mundo");
+ estoqueLoja.addEstoque(produto17);
+
+
+
+ }
+ }
+ public void verificarLogin(boolean logado, String user){
// Habilitar/desabilitar botão de Logout
if(logado==true){
btnLogout.setVisible(true);
@@ -44,37 +168,76 @@ public void verificarLogin(boolean logado){
btnLogin.setVisible(true);
lblLogin.setVisible(false);
}
-
}
+ public void atualizarLogin(){
+ // Habilitar/desabilitar botão de Logout
+ if(logado==true){
+ btnLogout.setVisible(true);
+ btnLogin.setVisible(false);
+ if(user.equals("cliente")){
+ lblLogin.setVisible(true);
+ lblLogin.setText("Você entrou como cliente!");
+ }else if(user.equals("funcionario")){
+ lblLogin.setVisible(true);
+ lblLogin.setText("Você entrou como funcionário");
+ }else if(user.equals("gerente")){
+ lblLogin.setVisible(true);
+ lblLogin.setText("Você entrou como gerente");
+ }
+ }else{
+ btnLogout.setVisible(false);
+ btnLogin.setVisible(true);
+ lblLogin.setVisible(false);
+ }
+ }
+ public void atualizarBotoes(){
+ if(logado==true){
+ if(user.equals("")){
+ btnCliente.setText("Criar conta de Cliente");
+ btnFuncionario.setText("Área do Funcionário");
+ btnFuncionario.setEnabled(false);
+ btnGerente.setEnabled(false);
+ btnAtualizarEstoque.setEnabled(false);
+ btnVerCarrinho.setEnabled(false);
+ }
+ if(user.equals("cliente")){
+ btnCliente.setText("Área do Cliente");
+ btnFuncionario.setEnabled(false);
+ btnGerente.setEnabled(false);
+ btnAtualizarEstoque.setEnabled(false);
+ btnVerCarrinho.setEnabled(true);
+
+
+ }
+ if(user.equals("funcionario")){
+ btnCliente.setText("Criar conta de Cliente");
+ btnFuncionario.setEnabled(true);
+ btnFuncionario.setText("Área do Funcionário");
+ btnGerente.setEnabled(false);
+ btnAtualizarEstoque.setEnabled(true);
+ btnVerCarrinho.setEnabled(true);
+
+ }
+ if(user.equals("gerente")){
+ btnCliente.setText("Criar conta de Cliente");
+ btnFuncionario.setEnabled(true);
+ btnFuncionario.setText("Criar Funcionário");
+ btnGerente.setEnabled(true);
+ btnGerente.setText("Área do Gerente");
+ btnAtualizarEstoque.setEnabled(true);
+ btnVerCarrinho.setEnabled(true);
-
- /**
- * Creates new form Menu
- */
- public Menu() {
- initComponents();
-
- setLocationRelativeTo(null);
- this.setExtendedState(MAXIMIZED_BOTH);
- verificarLogin(logado);
- Gerente gerente;
- gerente = new Gerente("admin","admin","admin@gmail.com","admin");
- listaGerente.add(gerente);
- lblLogin.setVisible(false);
- Funcionario funcionario;
- funcionario = new Funcionario("func","func","func@gmail.com","func");
- listaFuncionarios.add(funcionario);
- Cliente cliente = new Cliente("user","111-111","user@gmail.com","user","Pernambuco","10/05/1990","999-9999");
- listaClientes.add(cliente);
-
-
+ }
+
+ }else{
+ btnCliente.setText("Criar conta de Cliente");
+ btnFuncionario.setEnabled(false);
+ btnGerente.setEnabled(false);
+ btnAtualizarEstoque.setEnabled(false);
+ btnVerCarrinho.setEnabled(false);
+
+ }
}
- /**
- * 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")
// //GEN-BEGIN:initComponents
private void initComponents() {
@@ -82,7 +245,6 @@ private void initComponents() {
jLabel2 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
lblLogin = new javax.swing.JLabel();
- lblBookStockManager = new javax.swing.JLabel();
btnAtualizarEstoque = new javax.swing.JToggleButton();
btnVerCarrinho = new javax.swing.JButton();
btnPesquisar = new javax.swing.JButton();
@@ -91,7 +253,7 @@ private void initComponents() {
btnCliente = new javax.swing.JButton();
btnLogout = new javax.swing.JButton();
btnLogin = new javax.swing.JButton();
- jLabel1 = new javax.swing.JLabel();
+ jButton1 = new javax.swing.JButton();
lblLogo = new javax.swing.JLabel();
lblImagem = new javax.swing.JLabel();
@@ -101,79 +263,81 @@ private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Menu principal");
- setIconImage(new javax.swing.ImageIcon(getClass().getResource("/imagens/logo_digitalbooks03_small3.png")).getImage());
+ setIconImage(new javax.swing.ImageIcon(getClass().getResource("/imagens/logo_128.png")).getImage());
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- lblLogin.setFont(new java.awt.Font("Segoe UI", 1, 48)); // NOI18N
- lblLogin.setForeground(new java.awt.Color(255, 0, 0));
+ lblLogin.setFont(new java.awt.Font("Old London", 1, 80)); // NOI18N
+ lblLogin.setForeground(new java.awt.Color(255, 255, 255));
+ lblLogin.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblLogin.setText("Você entrou como cliente");
- jPanel1.add(lblLogin, new org.netbeans.lib.awtextra.AbsoluteConstraints(570, 60, -1, -1));
-
- lblBookStockManager.setFont(new java.awt.Font("Segoe UI", 1, 48)); // NOI18N
- lblBookStockManager.setForeground(new java.awt.Color(255, 255, 255));
- lblBookStockManager.setText("BookStock");
- jPanel1.add(lblBookStockManager, new org.netbeans.lib.awtextra.AbsoluteConstraints(1630, 210, -1, -1));
+ jPanel1.add(lblLogin, new org.netbeans.lib.awtextra.AbsoluteConstraints(500, 0, 1060, 100));
- btnAtualizarEstoque.setFont(new java.awt.Font("Segoe UI", 1, 36)); // NOI18N
+ btnAtualizarEstoque.setFont(new java.awt.Font("Old London", 1, 36)); // NOI18N
btnAtualizarEstoque.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/business_inventory_maintenance_product_box_boxes_2326_64.png"))); // NOI18N
btnAtualizarEstoque.setText("Atualizar Estoque");
+ btnAtualizarEstoque.setContentAreaFilled(false);
btnAtualizarEstoque.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnAtualizarEstoqueActionPerformed(evt);
}
});
- jPanel1.add(btnAtualizarEstoque, new org.netbeans.lib.awtextra.AbsoluteConstraints(1270, 700, 400, 130));
+ jPanel1.add(btnAtualizarEstoque, new org.netbeans.lib.awtextra.AbsoluteConstraints(1420, 640, 400, 130));
- btnVerCarrinho.setFont(new java.awt.Font("Segoe UI", 1, 36)); // NOI18N
+ btnVerCarrinho.setFont(new java.awt.Font("Old London", 1, 36)); // NOI18N
btnVerCarrinho.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/4105931-add-to-cart-buy-cart-sell-shop-shopping-cart_113919_64.png"))); // NOI18N
btnVerCarrinho.setText("Ver carrinho");
+ btnVerCarrinho.setContentAreaFilled(false);
btnVerCarrinho.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnVerCarrinhoActionPerformed(evt);
}
});
- jPanel1.add(btnVerCarrinho, new org.netbeans.lib.awtextra.AbsoluteConstraints(1270, 410, 400, 130));
+ jPanel1.add(btnVerCarrinho, new org.netbeans.lib.awtextra.AbsoluteConstraints(1400, 420, 400, 130));
- btnPesquisar.setFont(new java.awt.Font("Segoe UI", 1, 36)); // NOI18N
+ btnPesquisar.setFont(new java.awt.Font("Old London", 1, 36)); // NOI18N
btnPesquisar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/searchmagnifierinterfacesymbol1_79893_64.png"))); // NOI18N
btnPesquisar.setText("Buscar Produto");
+ btnPesquisar.setContentAreaFilled(false);
btnPesquisar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnPesquisarActionPerformed(evt);
}
});
- jPanel1.add(btnPesquisar, new org.netbeans.lib.awtextra.AbsoluteConstraints(750, 410, 400, 130));
+ jPanel1.add(btnPesquisar, new org.netbeans.lib.awtextra.AbsoluteConstraints(780, 400, 400, 130));
- btnFuncionario.setFont(new java.awt.Font("Segoe UI", 1, 36)); // NOI18N
- btnFuncionario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/technicalsupport_support_representative_person_people_man_1641_64.png"))); // NOI18N
+ btnFuncionario.setFont(new java.awt.Font("Old London", 1, 36)); // NOI18N
+ btnFuncionario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/cavaleiro64.png"))); // NOI18N
btnFuncionario.setText("Funcionário");
+ btnFuncionario.setContentAreaFilled(false);
btnFuncionario.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnFuncionarioActionPerformed(evt);
}
});
- jPanel1.add(btnFuncionario, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 700, 400, 130));
+ jPanel1.add(btnFuncionario, new org.netbeans.lib.awtextra.AbsoluteConstraints(110, 630, 400, 130));
- btnGerente.setFont(new java.awt.Font("Segoe UI", 1, 36)); // NOI18N
- btnGerente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/customer_person_people_man_you_1625_64.png"))); // NOI18N
+ btnGerente.setFont(new java.awt.Font("Old London", 1, 36)); // NOI18N
+ btnGerente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/rei64.png"))); // NOI18N
btnGerente.setText("Gerente");
+ btnGerente.setContentAreaFilled(false);
btnGerente.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnGerenteActionPerformed(evt);
}
});
- jPanel1.add(btnGerente, new org.netbeans.lib.awtextra.AbsoluteConstraints(750, 700, 400, 130));
+ jPanel1.add(btnGerente, new org.netbeans.lib.awtextra.AbsoluteConstraints(770, 640, 400, 130));
- btnCliente.setFont(new java.awt.Font("Segoe UI", 1, 36)); // NOI18N
- btnCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/person_user_customer_man_male_man_boy_people_1687_64.png"))); // NOI18N
+ btnCliente.setFont(new java.awt.Font("Old London", 1, 36)); // NOI18N
+ btnCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/aventureiro64.png"))); // NOI18N
btnCliente.setText("Cliente");
+ btnCliente.setContentAreaFilled(false);
btnCliente.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnClienteActionPerformed(evt);
}
});
- jPanel1.add(btnCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(250, 410, 400, 130));
+ jPanel1.add(btnCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 400, 400, 130));
btnLogout.setFont(new java.awt.Font("Segoe UI", 1, 36)); // NOI18N
btnLogout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/logout_90894_64.png"))); // NOI18N
@@ -185,7 +349,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
btnLogoutActionPerformed(evt);
}
});
- jPanel1.add(btnLogout, new org.netbeans.lib.awtextra.AbsoluteConstraints(290, 50, 200, 70));
+ jPanel1.add(btnLogout, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 200, 70));
btnLogin.setFont(new java.awt.Font("Segoe UI", 1, 36)); // NOI18N
btnLogin.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/login-square-arrow-button-outline_icon-icons.com_73220_64.png"))); // NOI18N
@@ -197,30 +361,37 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
btnLoginActionPerformed(evt);
}
});
- jPanel1.add(btnLogin, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 50, 200, 70));
-
- jLabel1.setFont(new java.awt.Font("Segoe UI", 1, 48)); // NOI18N
- jLabel1.setForeground(new java.awt.Color(255, 255, 255));
- jLabel1.setText("Manager");
- jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(1650, 250, -1, -1));
+ jPanel1.add(btnLogin, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 200, 70));
+
+ jButton1.setBackground(new java.awt.Color(255, 0, 0));
+ jButton1.setFont(new java.awt.Font("Old London", 0, 48)); // NOI18N
+ jButton1.setText("Fechar");
+ jButton1.setToolTipText("");
+ jButton1.setAlignmentY(0.0F);
+ jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton1ActionPerformed(evt);
+ }
+ });
+ jPanel1.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(1715, 20, 160, 60));
- lblLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/livro01.png"))); // NOI18N
- jPanel1.add(lblLogo, new org.netbeans.lib.awtextra.AbsoluteConstraints(1490, 10, 390, 210));
+ lblLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/logo256.png"))); // NOI18N
+ jPanel1.add(lblLogo, new org.netbeans.lib.awtextra.AbsoluteConstraints(860, 100, -1, 250));
- lblImagem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/background_resize.jpg"))); // NOI18N
- jPanel1.add(lblImagem, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1920, 1080));
+ lblImagem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Telas/Menu.png"))); // NOI18N
+ jPanel1.add(lblImagem, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
+ lblImagem.getAccessibleContext().setAccessibleName("");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(0, 6, Short.MAX_VALUE))
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 1081, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
@@ -230,8 +401,10 @@ private void btnLogoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR
// TODO add your handling code here:
logado=false;
user="";
- verificarLogin(logado);
- JOptionPane.showMessageDialog(null,"Você acabou de sair do sistema", "Mensagem",JOptionPane.PLAIN_MESSAGE);
+ verificarLogin(logado,user);
+ JOptionPane.showMessageDialog(null,"Você acabou de sair do sistema", "Mensagem",JOptionPane.INFORMATION_MESSAGE);
+ atualizarBotoes();
+
}//GEN-LAST:event_btnLogoutActionPerformed
@@ -245,28 +418,35 @@ private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS
tela.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosed(java.awt.event.WindowEvent windowEvent) {
- verificarLogin(logado);
+ verificarLogin(logado,user);
}
});
-
+ this.setVisible(false);
}//GEN-LAST:event_btnLoginActionPerformed
private void btnClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnClienteActionPerformed
// TODO add your handling code here:
- verificarLogin(logado);
+ verificarLogin(logado,user);
if(logado==true){
if(user.equals("gerente") || user.equals("funcionario")){
- JOptionPane.showMessageDialog(null,"Você tem acesso a criar nova conta de cliente","Notificação de acesso a cliente",JOptionPane.ERROR_MESSAGE);
- new cadastrarCliente().setVisible(true);
+ //JOptionPane.showMessageDialog(null,"Você tem acesso a criar nova conta de cliente","Notificação de acesso a cliente",JOptionPane.ERROR_MESSAGE);
+ int response = JOptionPane.showConfirmDialog(null, "Gostaria de criar uma nova conta como Cliente?","Confirmação",JOptionPane.YES_NO_OPTION);
+ if(response==JOptionPane.YES_OPTION){
+ cadastrosFlag = "cliente";
+ new cadastros().setVisible(true);
+ }
}else{
new areaCliente().setVisible(true);
}
}else{
- JOptionPane.showMessageDialog(null,"Você não entrou no sistema. Crie uma nova conta como Cliente", "Mensagem",JOptionPane.PLAIN_MESSAGE);
+ int response = JOptionPane.showConfirmDialog(null, "Você não entrou no sistema. Gostaria de criar uma nova conta como Cliente?","Confirmação",JOptionPane.YES_NO_OPTION);
+ if(response==JOptionPane.YES_OPTION){
+ new cadastros().setVisible(true);
+ }
- new cadastrarCliente().setVisible(true);
+ //new cadastrarCliente().setVisible(true);
}
}//GEN-LAST:event_btnClienteActionPerformed
@@ -278,13 +458,18 @@ private void btnPesquisarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-
private void btnFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFuncionarioActionPerformed
// TODO add your handling code here:
- verificarLogin(logado);
+ verificarLogin(logado,user);
if(logado==true){
if( user.equals("gerente")){
- new cadastrarFuncionario().setVisible(true);
+ int response = JOptionPane.showConfirmDialog(null, "Gostaria de criar uma nova conta como Funcionário?","Confirmação",JOptionPane.YES_NO_OPTION);
+ if(response==JOptionPane.YES_OPTION){
+ cadastrosFlag = "funcionario";
+ new cadastros().setVisible(true);
+ }
}else if(user.equals("funcionario")){
+ //cadastrosFlag="funcionario";
new areaFuncionario().setVisible(true);
}
else{
@@ -298,7 +483,7 @@ private void btnFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GE
private void btnGerenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGerenteActionPerformed
// TODO add your handling code here:
- verificarLogin(logado);
+ verificarLogin(logado,user);
if(logado==true){
if(user.equals("gerente")){
new areaGerente().setVisible(true);
@@ -316,7 +501,7 @@ private void btnGerenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI
private void btnVerCarrinhoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVerCarrinhoActionPerformed
// TODO add your handling code here:
//Verifica se o usuário está logado no sistema
- verificarLogin(logado);
+ verificarLogin(logado,user);
if(logado==true){
new verCarrinho().setVisible(true);
@@ -327,7 +512,8 @@ private void btnVerCarrinhoActionPerformed(java.awt.event.ActionEvent evt) {//GE
private void btnAtualizarEstoqueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAtualizarEstoqueActionPerformed
// TODO add your handling code here:
- verificarLogin(logado);
+ verificarLogin(logado,user);
+ System.out.println("User é "+user);
if(logado==true){
if(user.equals("funcionario") || user.equals("gerente") ){
new ControleEstoque().setVisible(true);
@@ -340,6 +526,11 @@ private void btnAtualizarEstoqueActionPerformed(java.awt.event.ActionEvent evt)
}
}//GEN-LAST:event_btnAtualizarEstoqueActionPerformed
+ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
+ // TODO add your handling code here:
+ System.exit(0);
+ }//GEN-LAST:event_jButton1ActionPerformed
+
/**
* @param args the command line arguments
*/
@@ -384,11 +575,10 @@ public void run() {
private javax.swing.JButton btnLogout;
private javax.swing.JButton btnPesquisar;
private javax.swing.JButton btnVerCarrinho;
- private javax.swing.JLabel jLabel1;
+ private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel2;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JPanel jPanel1;
- private javax.swing.JLabel lblBookStockManager;
private javax.swing.JLabel lblImagem;
private javax.swing.JLabel lblLogin;
private javax.swing.JLabel lblLogo;
diff --git a/src/telas/areaCliente.form b/src/telas/areaCliente.form
index 9eeb4a5..d3adabd 100644
--- a/src/telas/areaCliente.form
+++ b/src/telas/areaCliente.form
@@ -4,6 +4,9 @@
+
+
+
@@ -19,221 +22,206 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -241,7 +229,7 @@
-
+
@@ -249,6 +237,11 @@
+
+
+
+
+
@@ -256,7 +249,7 @@
-
+
@@ -264,6 +257,11 @@
+
+
+
+
+
@@ -271,7 +269,7 @@
-
+
@@ -279,11 +277,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -291,7 +302,15 @@
+
+
+
+
+
+
+
+
@@ -299,7 +318,15 @@
+
+
+
+
+
+
+
+
@@ -307,31 +334,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
+
+
+
+
+
diff --git a/src/telas/areaCliente.java b/src/telas/areaCliente.java
index 2f21e46..d5bae14 100644
--- a/src/telas/areaCliente.java
+++ b/src/telas/areaCliente.java
@@ -5,7 +5,9 @@
package telas;
import classes.Cliente;
+import static classes.Cliente.index_cliente;
import static classes.Cliente.listaClientes;
+import javax.swing.JOptionPane;
//import static telas.cadastrarCliente.listaClientes;
/**
@@ -25,7 +27,9 @@ public areaCliente() {
btnSalvarCliente.setEnabled(false);
btnCancelarCliente.setEnabled(false);
loadClienteFields();
-
+ disableClienteFields();
+ this.setExtendedState(MAXIMIZED_BOTH);
+
}
@@ -85,6 +89,8 @@ public void loadClienteFields(){
// //GEN-BEGIN:initComponents
private void initComponents() {
+ btnCarrinhosAnteriores = new javax.swing.JButton();
+ btnSair = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
lblDadosCliente = new javax.swing.JLabel();
lblNomeCliente = new javax.swing.JLabel();
@@ -104,43 +110,87 @@ private void initComponents() {
ftxNascimentoCliente = new javax.swing.JFormattedTextField();
ftxTelefone = new javax.swing.JFormattedTextField();
txtCPFCliente = new javax.swing.JFormattedTextField();
- btnSairCliente = new javax.swing.JButton();
lblAreaCliente = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
+ jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Área do cliente");
+ setIconImage(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/aventureiro64.png")).getImage());
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- lblDadosCliente.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
- lblDadosCliente.setText("meus dados");
+ btnCarrinhosAnteriores.setFont(new java.awt.Font("Old London", 0, 48)); // NOI18N
+ btnCarrinhosAnteriores.setText("Acessar Carrinhos Anteriores");
+ btnCarrinhosAnteriores.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCarrinhosAnterioresActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnCarrinhosAnteriores, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 270, -1, 70));
+ btnSair.setFont(new java.awt.Font("Old London", 0, 48)); // NOI18N
+ btnSair.setText("Sair");
+ btnSair.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSairActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnSair, new org.netbeans.lib.awtextra.AbsoluteConstraints(1660, 30, 130, 60));
+
+ jPanel1.setBackground(new java.awt.Color(211, 181, 143));
+ jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ lblDadosCliente.setFont(new java.awt.Font("Old London", 1, 24)); // NOI18N
+ lblDadosCliente.setText("Meus Dados");
+ jPanel1.add(lblDadosCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 26, 130, 30));
+
+ lblNomeCliente.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
lblNomeCliente.setText("Nome");
+ jPanel1.add(lblNomeCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 60, 80, 50));
+ lblCPFCliente.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
lblCPFCliente.setText("CPF");
+ jPanel1.add(lblCPFCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 280, 70, 70));
+ lblEmailCliente.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
lblEmailCliente.setText("E-mail");
+ jPanel1.add(lblEmailCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 130, 100, 50));
+ lblSenhaCliente.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
lblSenhaCliente.setText("Senha");
+ jPanel1.add(lblSenhaCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 380, 130, 50));
+ lblEnderecoCliente.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
lblEnderecoCliente.setText("Endereço");
+ jPanel1.add(lblEnderecoCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 210, 130, 50));
- lblNascimentoCliente.setText("data de nascimento");
+ lblNascimentoCliente.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
+ lblNascimentoCliente.setText("Data de nascimento");
+ jPanel1.add(lblNascimentoCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 460, 260, 50));
+ txtNomeCliente.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
txtNomeCliente.setToolTipText("Nome do cliente");
txtNomeCliente.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtNomeClienteActionPerformed(evt);
}
});
+ jPanel1.add(txtNomeCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 110, 560, 40));
+ txtEmailCliente.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
txtEmailCliente.setToolTipText("email cadastrado");
+ jPanel1.add(txtEmailCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 180, 560, 40));
+ txtSenhaCliente.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
txtSenhaCliente.setToolTipText("senha do cliente");
+ jPanel1.add(txtSenhaCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 430, 550, 40));
+ txtEnderecoCliente.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
txtEnderecoCliente.setToolTipText("endereço salvo");
+ jPanel1.add(txtEnderecoCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 260, 550, 40));
btnSalvarCliente.setBackground(new java.awt.Color(51, 204, 0));
- btnSalvarCliente.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnSalvarCliente.setFont(new java.awt.Font("Old London", 1, 36)); // NOI18N
btnSalvarCliente.setText("Salvar");
btnSalvarCliente.setToolTipText("salvar as alterações");
btnSalvarCliente.addActionListener(new java.awt.event.ActionListener() {
@@ -148,9 +198,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSalvarClienteActionPerformed(evt);
}
});
+ jPanel1.add(btnSalvarCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(230, 730, -1, 60));
btnAlterarCliente.setBackground(new java.awt.Color(255, 255, 0));
- btnAlterarCliente.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnAlterarCliente.setFont(new java.awt.Font("Old London", 1, 36)); // NOI18N
btnAlterarCliente.setText("Alterar");
btnAlterarCliente.setToolTipText("alterar os dados");
btnAlterarCliente.addActionListener(new java.awt.event.ActionListener() {
@@ -158,9 +209,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
btnAlterarClienteActionPerformed(evt);
}
});
+ jPanel1.add(btnAlterarCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 730, -1, 60));
btnCancelarCliente.setBackground(new java.awt.Color(255, 0, 0));
- btnCancelarCliente.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnCancelarCliente.setFont(new java.awt.Font("Old London", 1, 36)); // NOI18N
btnCancelarCliente.setText("Cancelar");
btnCancelarCliente.setToolTipText("cancelar a operação");
btnCancelarCliente.addActionListener(new java.awt.event.ActionListener() {
@@ -168,8 +220,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCancelarClienteActionPerformed(evt);
}
});
+ jPanel1.add(btnCancelarCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 730, -1, 60));
+ lblCelularCliente.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
lblCelularCliente.setText("Celular");
+ jPanel1.add(lblCelularCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 560, 160, 50));
try {
ftxNascimentoCliente.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
@@ -177,6 +232,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
ex.printStackTrace();
}
ftxNascimentoCliente.setToolTipText("data de nascimento do cliente");
+ ftxNascimentoCliente.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ jPanel1.add(ftxNascimentoCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 510, 550, 50));
try {
ftxTelefone.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#####-####")));
@@ -184,6 +241,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
ex.printStackTrace();
}
ftxTelefone.setToolTipText("número de contato");
+ ftxTelefone.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ jPanel1.add(ftxTelefone, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 620, 560, 40));
try {
txtCPFCliente.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
@@ -191,146 +250,23 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
ex.printStackTrace();
}
txtCPFCliente.setToolTipText("CPF do cliente");
+ txtCPFCliente.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ jPanel1.add(txtCPFCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 340, 560, 50));
- javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
- jPanel1.setLayout(jPanel1Layout);
- jPanel1Layout.setHorizontalGroup(
- jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(lblDadosCliente)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(3, 3, 3)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addComponent(lblNomeCliente)
- .addGap(2, 2, 2)
- .addComponent(txtNomeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addComponent(lblCPFCliente)
- .addGap(38, 38, 38)
- .addComponent(txtCPFCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(211, 211, 211)
- .addComponent(lblNascimentoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(ftxNascimentoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(20, 20, 20)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(lblEmailCliente)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
- .addGap(3, 3, 3)
- .addComponent(lblSenhaCliente)))
- .addComponent(lblCelularCliente))
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(18, 18, 18)
- .addComponent(txtEmailCliente, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE))
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(18, 18, 18)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(ftxTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(txtSenhaCliente))))
- .addGap(37, 37, 37)
- .addComponent(lblEnderecoCliente)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(txtEnderecoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)))))
- .addGap(45, 45, 45))
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(btnAlterarCliente)
- .addGap(150, 150, 150)
- .addComponent(btnSalvarCliente)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(btnCancelarCliente)
- .addGap(63, 63, 63))
- );
- jPanel1Layout.setVerticalGroup(
- jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(26, 26, 26)
- .addComponent(lblDadosCliente)
- .addGap(18, 18, 18)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblNomeCliente)
- .addComponent(txtNomeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(lblEmailCliente)
- .addComponent(txtEmailCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(lblEnderecoCliente)
- .addComponent(txtEnderecoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(30, 30, 30)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblCPFCliente)
- .addComponent(lblSenhaCliente)
- .addComponent(lblNascimentoCliente)
- .addComponent(txtSenhaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(ftxNascimentoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(txtCPFCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblCelularCliente)
- .addComponent(ftxTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(25, 25, 25)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(btnAlterarCliente)
- .addComponent(btnSalvarCliente)
- .addComponent(btnCancelarCliente))
- .addContainerGap(14, Short.MAX_VALUE))
- );
-
- btnSairCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/exit_icon-icons.com_70975.png"))); // NOI18N
- btnSairCliente.setText("Sair");
- btnSairCliente.setToolTipText("Sair da área do cliente");
- btnSairCliente.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- btnSairClienteActionPerformed(evt);
- }
- });
-
- lblAreaCliente.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ lblAreaCliente.setFont(new java.awt.Font("Old London", 1, 36)); // NOI18N
lblAreaCliente.setText("Área do Cliente");
+ jPanel1.add(lblAreaCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 0, -1, 50));
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(btnSairCliente)
- .addGap(171, 171, 171)
- .addComponent(lblAreaCliente))
- .addGroup(layout.createSequentialGroup()
- .addGap(30, 30, 30)
- .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 628, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addContainerGap(32, Short.MAX_VALUE))
- .addComponent(jSeparator1)
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(btnSairCliente)
- .addComponent(lblAreaCliente))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addContainerGap())
- );
+ jSeparator1.setForeground(new java.awt.Color(150, 114, 69));
+ jPanel1.add(jSeparator1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 60, 610, 10));
- pack();
- }// //GEN-END:initComponents
+ getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(788, 100, 610, 810));
- private void btnSairClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSairClienteActionPerformed
- // TODO add your handling code here:
- this.setVisible(false);
+ jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Telas/ÁreaCliente.png"))); // NOI18N
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
- }//GEN-LAST:event_btnSairClienteActionPerformed
+ pack();
+ }// //GEN-END:initComponents
private void txtNomeClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNomeClienteActionPerformed
// TODO add your handling code here:
@@ -355,12 +291,38 @@ private void btnCancelarClienteActionPerformed(java.awt.event.ActionEvent evt) {
private void btnSalvarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarClienteActionPerformed
// TODO add your handling code here:
+ Cliente cliente = listaClientes.get(index_cliente);
+ cliente.setNome(txtNomeCliente.getText());
+ cliente.setCPF(txtCPFCliente.getText());
+ cliente.setCelular(ftxTelefone.getText());
+ cliente.setDataNascimento(ftxNascimentoCliente.getText());
+ cliente.setEmail(txtEmailCliente.getText());
+ cliente.setSenha(txtSenhaCliente.getText());
+ cliente.setEndereco(txtEnderecoCliente.getText());
+
+
+
+
+
+
disableClienteFields();
btnAlterarCliente.setEnabled(true);
btnCancelarCliente.setEnabled(false);
btnSalvarCliente.setEnabled(false);
+ JOptionPane.showMessageDialog(null, "Dados atualizados com sucesso!", "Atualização de dados", JOptionPane.INFORMATION_MESSAGE);
+
}//GEN-LAST:event_btnSalvarClienteActionPerformed
+ private void btnSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSairActionPerformed
+ // TODO add your handling code here:
+ this.setVisible(false);
+ }//GEN-LAST:event_btnSairActionPerformed
+
+ private void btnCarrinhosAnterioresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCarrinhosAnterioresActionPerformed
+ // TODO add your handling code here:
+ new verCarrinho().setVisible(true);
+ }//GEN-LAST:event_btnCarrinhosAnterioresActionPerformed
+
/**
* @param args the command line arguments
*/
@@ -399,10 +361,12 @@ public void run() {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnAlterarCliente;
private javax.swing.JButton btnCancelarCliente;
- private javax.swing.JButton btnSairCliente;
+ private javax.swing.JButton btnCarrinhosAnteriores;
+ private javax.swing.JButton btnSair;
private javax.swing.JButton btnSalvarCliente;
private javax.swing.JFormattedTextField ftxNascimentoCliente;
private javax.swing.JFormattedTextField ftxTelefone;
+ private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JLabel lblAreaCliente;
diff --git a/src/telas/areaFuncionario.form b/src/telas/areaFuncionario.form
index 9618935..f8f87ea 100644
--- a/src/telas/areaFuncionario.form
+++ b/src/telas/areaFuncionario.form
@@ -4,6 +4,9 @@
+
+
+
@@ -19,120 +22,157 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -141,58 +181,88 @@
-
+
+
+
+
+
+
+
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -202,7 +272,7 @@
-
+
@@ -217,7 +287,7 @@
-
+
@@ -232,7 +302,7 @@
-
+
@@ -244,12 +314,231 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/telas/areaFuncionario.java b/src/telas/areaFuncionario.java
index 5157dd8..5017419 100644
--- a/src/telas/areaFuncionario.java
+++ b/src/telas/areaFuncionario.java
@@ -4,8 +4,14 @@
*/
package telas;
+import classes.Cliente;
+import static classes.Cliente.listaClientes;
import classes.Funcionario;
+import static classes.Funcionario.index_func;
import static classes.Funcionario.listaFuncionarios;
+import javax.swing.JOptionPane;
+import javax.swing.table.DefaultTableModel;
+import static telas.cadastros.cadastrosFlag;
//import static telas.cadastrarFuncionario.listaFuncionarios;
/**
@@ -25,6 +31,9 @@ public areaFuncionario() {
btnSalvarFuncionario.setEnabled(false);
btnCancelarFuncionario.setEnabled(false);
loadFuncionarioFields();
+ this.setExtendedState(MAXIMIZED_BOTH);
+ carregarTabelaCliente();
+
setLocationRelativeTo(null);
}
@@ -64,6 +73,32 @@ public void loadFuncionarioFields(){
txtSenhaFuncionario.setText(funcionario_dados.getSenha());
txtCodigoFuncionario.setText(funcionario_dados.getCadastroFuncionario());
}
+
+ private void carregarTabelaCliente(){
+ DefaultTableModel modeloTabelaCliente = new DefaultTableModel(new Object[] {"Cod.Cliente","Nome","CPF","Data Nascimento","Endereço"},0);
+
+ for(int i=0;i//GEN-BEGIN:initComponents
private void initComponents() {
+ btnSair = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
lblDadosFuncionario = new javax.swing.JLabel();
lblNomeFuncionario = new javax.swing.JLabel();
@@ -90,35 +126,74 @@ private void initComponents() {
btnCancelarFuncionario = new javax.swing.JButton();
btnSalvarFuncionario = new javax.swing.JButton();
lblAreaFuncionario = new javax.swing.JLabel();
+ jPanel3 = new javax.swing.JPanel();
+ lblControleClientes = new javax.swing.JLabel();
+ lblNomeCliente = new javax.swing.JLabel();
+ txtNomeCliente = new javax.swing.JTextField();
+ lblCPFCliente = new javax.swing.JLabel();
+ lblCodigoCliente = new javax.swing.JLabel();
+ txtCodCliente = new javax.swing.JTextField();
+ btnBuscarCliente = new javax.swing.JButton();
+ btnNovoCliente = new javax.swing.JButton();
+ btnSalvarCliente = new javax.swing.JButton();
+ btnExluirCliente = new javax.swing.JButton();
+ jScrollPane3 = new javax.swing.JScrollPane();
+ tblControleClientes = new javax.swing.JTable();
+ txtCPFCliente = new javax.swing.JFormattedTextField();
+ jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Área do funcionário");
+ setIconImage(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/cavaleiro64.png")).getImage());
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ btnSair.setBackground(new java.awt.Color(255, 0, 0));
+ btnSair.setFont(new java.awt.Font("Old London", 0, 48)); // NOI18N
+ btnSair.setText("Sair");
+ btnSair.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSairActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnSair, new org.netbeans.lib.awtextra.AbsoluteConstraints(1650, 10, 130, 60));
+
+ jPanel1.setBackground(new java.awt.Color(211, 181, 143));
- lblDadosFuncionario.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
+ lblDadosFuncionario.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
lblDadosFuncionario.setText("meus dados");
+ lblNomeFuncionario.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
lblNomeFuncionario.setText("Nome");
+ lblCPFFuncionario.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
lblCPFFuncionario.setText("CPF");
- lblEmailFuncionario.setText("e-mail");
+ lblEmailFuncionario.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
+ lblEmailFuncionario.setText("Email");
- lblSenhaFuncionario.setText("senha");
+ lblSenhaFuncionario.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
+ lblSenhaFuncionario.setText("Senha");
+ lblCodFuncionario.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
lblCodFuncionario.setText("Código de Funcionário");
+ txtNomeFuncionario.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
txtNomeFuncionario.setToolTipText("Nome do funcionário");
+ txtCPFFuncionario.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
txtCPFFuncionario.setToolTipText("CPF do funcionário");
+ txtEmailFuncionario.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
txtEmailFuncionario.setToolTipText("email do funcionário");
+ txtSenhaFuncionario.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
txtSenhaFuncionario.setToolTipText("senha do funcionário");
+ txtCodigoFuncionario.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
txtCodigoFuncionario.setToolTipText("código do funcionário");
btnAlterarFuncionario.setBackground(new java.awt.Color(255, 255, 0));
- btnAlterarFuncionario.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
+ btnAlterarFuncionario.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
btnAlterarFuncionario.setText("Alterar");
btnAlterarFuncionario.setToolTipText("Alterar algum dado");
btnAlterarFuncionario.addActionListener(new java.awt.event.ActionListener() {
@@ -128,7 +203,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
});
btnCancelarFuncionario.setBackground(new java.awt.Color(255, 0, 0));
- btnCancelarFuncionario.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
+ btnCancelarFuncionario.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
btnCancelarFuncionario.setText("Cancelar");
btnCancelarFuncionario.setToolTipText("Cancelar a operação");
btnCancelarFuncionario.addActionListener(new java.awt.event.ActionListener() {
@@ -138,7 +213,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
});
btnSalvarFuncionario.setBackground(new java.awt.Color(102, 255, 0));
- btnSalvarFuncionario.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
+ btnSalvarFuncionario.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
btnSalvarFuncionario.setText("Salvar");
btnSalvarFuncionario.setToolTipText("salvar dados");
btnSalvarFuncionario.addActionListener(new java.awt.event.ActionListener() {
@@ -147,7 +222,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});
- lblAreaFuncionario.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ lblAreaFuncionario.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
lblAreaFuncionario.setText("Área do funcionário");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
@@ -155,92 +230,235 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(267, 267, 267)
- .addComponent(lblAreaFuncionario)
- .addGap(0, 0, Short.MAX_VALUE))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(lblDadosFuncionario)
- .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(6, 6, 6)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(lblCPFFuncionario)
- .addComponent(lblNomeFuncionario)
- .addComponent(lblEmailFuncionario)
- .addComponent(lblSenhaFuncionario)
- .addComponent(lblCodFuncionario))))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24, Short.MAX_VALUE)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
+ .addComponent(txtCPFFuncionario, javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
+ .addGap(6, 6, 6)
+ .addComponent(txtNomeFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 494, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGap(0, 22, Short.MAX_VALUE))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(6, 6, 6)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(txtEmailFuncionario)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(lblNomeFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblSenhaFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblEmailFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(6, 6, 6)
+ .addComponent(txtSenhaFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 486, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGap(0, 0, Short.MAX_VALUE)))))
+ .addContainerGap())
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(6, 6, 6)
+ .addComponent(lblCPFFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 0, Short.MAX_VALUE))))
.addGroup(jPanel1Layout.createSequentialGroup()
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(txtEmailFuncionario)
- .addComponent(txtCPFFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 139, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(txtNomeFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(314, 314, 314))
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(txtSenhaFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(txtCodigoFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(btnAlterarFuncionario)
- .addGap(168, 168, 168)
- .addComponent(btnSalvarFuncionario)
- .addGap(129, 129, 129)
- .addComponent(btnCancelarFuncionario)
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(txtCodigoFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 497, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(btnAlterarFuncionario)
+ .addGap(70, 70, 70)
+ .addComponent(btnSalvarFuncionario)
+ .addGap(58, 58, 58)
+ .addComponent(btnCancelarFuncionario))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(lblDadosFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(18, 18, 18)
+ .addComponent(lblAreaFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 286, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(lblCodFuncionario)))
+ .addGap(0, 0, Short.MAX_VALUE))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
- .addComponent(lblAreaFuncionario)
- .addGap(26, 26, 26)
- .addComponent(lblDadosFuncionario)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblNomeFuncionario)
- .addComponent(txtNomeFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblCPFFuncionario)
- .addComponent(txtCPFFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(lblAreaFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(22, 22, 22)
+ .addComponent(lblDadosFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(lblNomeFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtNomeFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblEmailFuncionario)
- .addComponent(txtEmailFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblSenhaFuncionario)
- .addComponent(txtSenhaFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(18, 18, 18)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblCodFuncionario)
- .addComponent(txtCodigoFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(btnAlterarFuncionario)
- .addComponent(btnSalvarFuncionario)
- .addComponent(btnCancelarFuncionario))
- .addContainerGap(44, Short.MAX_VALUE))
+ .addComponent(lblCPFFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtCPFFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(lblEmailFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtEmailFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(lblSenhaFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtSenhaFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(lblCodFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtCodigoFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(56, 56, 56)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(btnAlterarFuncionario, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnCancelarFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnSalvarFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGap(58, 58, 58))
);
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
+ getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(830, 210, 540, 700));
+
+ jPanel3.setBackground(new java.awt.Color(211, 181, 143));
+
+ lblControleClientes.setFont(new java.awt.Font("Old English Text MT", 1, 36)); // NOI18N
+ lblControleClientes.setText("Controle de Clientes");
+
+ lblNomeCliente.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
+ lblNomeCliente.setText("Nome");
+
+ lblCPFCliente.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
+ lblCPFCliente.setText("CPF");
+
+ lblCodigoCliente.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
+ lblCodigoCliente.setText("Código de Cliente");
+
+ btnBuscarCliente.setFont(new java.awt.Font("Old London", 0, 20)); // NOI18N
+ btnBuscarCliente.setText("Buscar");
+ btnBuscarCliente.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnBuscarClienteActionPerformed(evt);
+ }
+ });
+
+ btnNovoCliente.setBackground(new java.awt.Color(0, 255, 204));
+ btnNovoCliente.setFont(new java.awt.Font("Old London", 0, 20)); // NOI18N
+ btnNovoCliente.setText("Novo");
+ btnNovoCliente.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnNovoClienteActionPerformed(evt);
+ }
+ });
+
+ btnSalvarCliente.setBackground(new java.awt.Color(51, 255, 0));
+ btnSalvarCliente.setFont(new java.awt.Font("Old London", 0, 20)); // NOI18N
+ btnSalvarCliente.setText("Salvar");
+ btnSalvarCliente.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSalvarClienteActionPerformed(evt);
+ }
+ });
+
+ btnExluirCliente.setBackground(new java.awt.Color(102, 102, 102));
+ btnExluirCliente.setFont(new java.awt.Font("Old London", 0, 20)); // NOI18N
+ btnExluirCliente.setText("Excluir");
+ btnExluirCliente.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnExluirClienteActionPerformed(evt);
+ }
+ });
+
+ tblControleClientes.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+ {null, null, null, null, null},
+ {null, null, null, null, null},
+ {null, null, null, null, null},
+ {null, null, null, null, null}
+ },
+ new String [] {
+ "Código Cliente", "Nome", "CPF", "Data Nascimento", "Endereço"
+ }
+ ) {
+ Class[] types = new Class [] {
+ java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
+ };
+
+ public Class getColumnClass(int columnIndex) {
+ return types [columnIndex];
+ }
+ });
+ jScrollPane3.setViewportView(tblControleClientes);
+
+ try {
+ txtCPFCliente.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
+ } catch (java.text.ParseException ex) {
+ ex.printStackTrace();
+ }
+
+ javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
+ jPanel3.setLayout(jPanel3Layout);
+ jPanel3Layout.setHorizontalGroup(
+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
- .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 579, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
+ .addComponent(lblNomeCliente)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtNomeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(lblCPFCliente)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtCPFCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
+ .addComponent(btnNovoCliente)
+ .addGap(78, 78, 78)
+ .addComponent(btnSalvarCliente)
+ .addGap(65, 65, 65)
+ .addComponent(btnExluirCliente)))
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addGap(62, 62, 62)
+ .addComponent(btnBuscarCliente))
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(lblCodigoCliente)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtCodCliente))))
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addGap(133, 133, 133)
+ .addComponent(lblControleClientes)))
+ .addGap(12, 12, 12))
);
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap(45, Short.MAX_VALUE)
- .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ jPanel3Layout.setVerticalGroup(
+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addComponent(lblControleClientes)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblNomeCliente)
+ .addComponent(txtNomeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblCPFCliente)
+ .addComponent(lblCodigoCliente)
+ .addComponent(txtCodCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(txtCPFCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(17, 17, 17)
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnNovoCliente)
+ .addComponent(btnSalvarCliente)
+ .addComponent(btnExluirCliente)
+ .addComponent(btnBuscarCliente))
+ .addGap(8, 8, 8)
+ .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE))
);
+ getContentPane().add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 170, 600, 410));
+
+ jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Telas/ÁreaFuncionário.png"))); // NOI18N
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
+
pack();
}// //GEN-END:initComponents
@@ -258,18 +476,79 @@ private void btnCancelarFuncionarioActionPerformed(java.awt.event.ActionEvent ev
btnAlterarFuncionario.setEnabled(true);
btnSalvarFuncionario.setEnabled(false);
btnCancelarFuncionario.setEnabled(false);
+ loadFuncionarioFields();
}//GEN-LAST:event_btnCancelarFuncionarioActionPerformed
private void btnSalvarFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarFuncionarioActionPerformed
// TODO add your handling code here:
+ Funcionario funcionario = listaFuncionarios.get(index_func);
+ funcionario.setNome(txtNomeFuncionario.getText());
+ funcionario.setCPF(txtCPFFuncionario.getText());
+ funcionario.setEmail(txtEmailFuncionario.getText());
+ funcionario.setSenha(txtSenhaFuncionario.getText());
+
disableFuncionarioFields();
btnAlterarFuncionario.setEnabled(true);
btnSalvarFuncionario.setEnabled(false);
btnCancelarFuncionario.setEnabled(false);
+ JOptionPane.showMessageDialog(null, "Dados atualizados com sucesso!", "Atualização de dados", JOptionPane.INFORMATION_MESSAGE);
+
}//GEN-LAST:event_btnSalvarFuncionarioActionPerformed
+ private void btnSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSairActionPerformed
+ // TODO add your handling code here:
+ this.setVisible(false);
+ }//GEN-LAST:event_btnSairActionPerformed
+
+ private void btnNovoClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNovoClienteActionPerformed
+ // TODO add your handling code here:
+
+ cadastrosFlag="cliente";
+ new cadastros().setVisible(true);
+ btnSalvarCliente.setEnabled(true);
+ }//GEN-LAST:event_btnNovoClienteActionPerformed
+
+ private void btnSalvarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarClienteActionPerformed
+ // TODO add your handling code here:
+ carregarTabelaCliente();
+ }//GEN-LAST:event_btnSalvarClienteActionPerformed
+
+ private void btnExluirClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExluirClienteActionPerformed
+ // TODO add your handling code here:
+ int i = tblControleClientes.getSelectedRow();
+
+ if (i>=0 && i
+
+
+
@@ -42,23 +45,29 @@
-
+
-
+
+
+
+
-
+
-
+
+
+
+
-
+
@@ -70,7 +79,7 @@
-
+
@@ -79,16 +88,8 @@
-
-
-
-
-
-
-
-
-
-
+
+
@@ -96,41 +97,52 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -138,32 +150,32 @@
-
+
-
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
+
-
-
-
+
+
+
@@ -174,7 +186,7 @@
-
+
@@ -182,7 +194,7 @@
-
+
@@ -190,7 +202,7 @@
-
+
@@ -198,7 +210,7 @@
-
+
@@ -206,7 +218,7 @@
-
+
@@ -214,7 +226,7 @@
-
+
@@ -225,20 +237,23 @@
-
+
+
+
+
-
+
@@ -249,12 +264,15 @@
+
+
+
-
+
-
+
@@ -265,7 +283,7 @@
-
+
@@ -280,7 +298,7 @@
-
+
@@ -295,7 +313,7 @@
-
+
@@ -314,7 +332,7 @@
-
+
@@ -345,17 +363,17 @@
-
+
+
+
-
-
-
+
-
+
@@ -368,26 +386,27 @@
-
-
-
+
+
+
+
+
-
-
-
+
+
@@ -432,8 +451,11 @@
-
-
+
+
+
+
+
@@ -450,6 +472,9 @@
+
+
+
@@ -463,41 +488,29 @@
-
+
-
-
-
-
-
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
+
@@ -508,13 +521,19 @@
+
+
+
-
-
+
+
+
+
+
@@ -525,12 +544,18 @@
-
-
+
+
+
+
+
+
+
+
@@ -550,73 +575,75 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
-
+
+
-
+
@@ -624,7 +651,7 @@
-
+
@@ -632,9 +659,9 @@
-
+
-
+
@@ -642,9 +669,7 @@
-
-
-
+
@@ -652,37 +677,125 @@
-
+
-
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
diff --git a/src/telas/areaGerente.java b/src/telas/areaGerente.java
index 7877159..b1d6e8c 100644
--- a/src/telas/areaGerente.java
+++ b/src/telas/areaGerente.java
@@ -4,8 +4,15 @@
*/
package telas;
+import classes.Cliente;
+import static classes.Cliente.listaClientes;
+import classes.Funcionario;
+import static classes.Funcionario.listaFuncionarios;
import classes.Gerente;
+import javax.swing.JOptionPane;
+import javax.swing.table.DefaultTableModel;
import static telas.cadastarGerente.listaGerente;
+import static telas.cadastros.cadastrosFlag;
/**
*
@@ -20,9 +27,15 @@ public areaGerente() {
initComponents();
setLocationRelativeTo(null);
+ this.setExtendedState(MAXIMIZED_BOTH);
+
disableGerenteFields();
disableControleFuncionariosButtons();
disableControleFuncionariosFields();
+ carregarTabelaFuncionario();
+ carregarTabelaCliente();
+ enableFuncionarioInfo();
+
btnCancelarGerente.setEnabled(false);
btnSalvarGerente.setEnabled(false);
@@ -38,6 +51,12 @@ public areaGerente() {
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
+ public void enableFuncionarioInfo(){
+ txtNomeFuncionario.setEnabled(true);
+ ftxCPFFuncionario.setEnabled(true);
+ txtCodigoFuncionario.setEnabled(true);
+ btnBuscarFuncionario.setEnabled(true);
+ }
public void loadGerenteInfo(){
Gerente gerente1 = listaGerente.get(0);
@@ -47,13 +66,60 @@ public void loadGerenteInfo(){
txtSenhaGerente.setText(gerente1.getSenha());
txtIdGerente.setText(gerente1.getCadastroGerente());
}
+
+ //Carregar a tabela com os funcionários da lista
+ private void carregarTabelaFuncionario() {
+ DefaultTableModel modeloTabela = new DefaultTableModel(new Object[] {"Cod.Funcionário","Nome","CPF"},0);
+
+ for(int i=0;i//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane2 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
- lblAreaGerente = new javax.swing.JLabel();
+ btnSair = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
lblNomeGerente = new javax.swing.JLabel();
lblCPFGerente = new javax.swing.JLabel();
@@ -65,7 +131,7 @@ private void initComponents() {
txtSenhaGerente = new javax.swing.JTextField();
txtIdGerente = new javax.swing.JTextField();
ftxCPFGerente = new javax.swing.JFormattedTextField();
- lblDadosGerente = new javax.swing.JLabel();
+ lblAreaGerente = new javax.swing.JLabel();
btnAlterarGerente = new javax.swing.JButton();
btnSalvarGerente = new javax.swing.JButton();
btnCancelarGerente = new javax.swing.JButton();
@@ -79,23 +145,25 @@ private void initComponents() {
btnBuscarFuncionario = new javax.swing.JButton();
ftxCPFFuncionario = new javax.swing.JFormattedTextField();
jScrollPane1 = new javax.swing.JScrollPane();
- tblControleFuncionariosx = new javax.swing.JTable();
+ tblControleFuncionarios = new javax.swing.JTable();
btnSalvarFuncionario = new javax.swing.JButton();
btnExcluirFuncionario = new javax.swing.JButton();
lblControleFuncionarios = new javax.swing.JLabel();
jPanel3 = new javax.swing.JPanel();
- jLabel2 = new javax.swing.JLabel();
- jLabel3 = new javax.swing.JLabel();
- jTextField1 = new javax.swing.JTextField();
- jLabel4 = new javax.swing.JLabel();
- jTextField2 = new javax.swing.JTextField();
- jLabel5 = new javax.swing.JLabel();
- jTextField3 = new javax.swing.JTextField();
- jButton1 = new javax.swing.JButton();
- jButton2 = new javax.swing.JButton();
- jButton3 = new javax.swing.JButton();
- jButton4 = new javax.swing.JButton();
- jLabel1 = new javax.swing.JLabel();
+ lblControleClientes = new javax.swing.JLabel();
+ lblNomeCliente = new javax.swing.JLabel();
+ txtNomeCliente = new javax.swing.JTextField();
+ lblCPFCliente = new javax.swing.JLabel();
+ lblCodigoCliente = new javax.swing.JLabel();
+ txtCodCliente = new javax.swing.JTextField();
+ btnBuscarCliente = new javax.swing.JButton();
+ btnNovoCliente = new javax.swing.JButton();
+ btnSalvarCliente = new javax.swing.JButton();
+ btnExluirCliente = new javax.swing.JButton();
+ jScrollPane3 = new javax.swing.JScrollPane();
+ tblControleClientes = new javax.swing.JTable();
+ txtCPFCliente = new javax.swing.JFormattedTextField();
+ lblBackground = new javax.swing.JLabel();
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
@@ -112,30 +180,37 @@ private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Área do Gerente");
+ setIconImage(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/rei64.png")).getImage());
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- lblAreaGerente.setFont(new java.awt.Font("Old English Text MT", 1, 48)); // NOI18N
- lblAreaGerente.setText("Dados do Gerente");
- getContentPane().add(lblAreaGerente, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 160, -1, -1));
+ btnSair.setBackground(new java.awt.Color(255, 0, 0));
+ btnSair.setFont(new java.awt.Font("Old London", 0, 48)); // NOI18N
+ btnSair.setText("Sair");
+ btnSair.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSairActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnSair, new org.netbeans.lib.awtextra.AbsoluteConstraints(1780, 10, 130, 60));
jPanel1.setBackground(new java.awt.Color(211, 181, 143));
- lblNomeGerente.setFont(new java.awt.Font("Old English Text MT", 1, 36)); // NOI18N
+ lblNomeGerente.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
lblNomeGerente.setText("Nome");
- lblCPFGerente.setFont(new java.awt.Font("Old English Text MT", 0, 36)); // NOI18N
+ lblCPFGerente.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
lblCPFGerente.setText("CPF");
- lblEmailGerente.setFont(new java.awt.Font("Old English Text MT", 0, 36)); // NOI18N
+ lblEmailGerente.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
lblEmailGerente.setText("E-mail");
- lblSenhaGerente.setFont(new java.awt.Font("Old English Text MT", 0, 36)); // NOI18N
+ lblSenhaGerente.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
lblSenhaGerente.setText("Senha");
- lblIdGerente.setFont(new java.awt.Font("Old English Text MT", 0, 36)); // NOI18N
+ lblIdGerente.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
lblIdGerente.setText("Id Gerente");
- txtNomeGerente.setFont(new java.awt.Font("Old English Text MT", 0, 24)); // NOI18N
+ txtNomeGerente.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
txtNomeGerente.setToolTipText("insira o nome");
txtNomeGerente.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -143,12 +218,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});
- txtEmailGerente.setFont(new java.awt.Font("Segoe UI", 0, 24)); // NOI18N
+ txtEmailGerente.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
txtEmailGerente.setToolTipText("insira o e-mail");
+ txtSenhaGerente.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
txtSenhaGerente.setToolTipText("defina uma senha");
- txtIdGerente.setFont(new java.awt.Font("Old English Text MT", 0, 24)); // NOI18N
+ txtIdGerente.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
txtIdGerente.setToolTipText("defina um Id Gerente");
try {
@@ -157,12 +233,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
ex.printStackTrace();
}
ftxCPFGerente.setToolTipText("insira o CPF");
+ ftxCPFGerente.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
- lblDadosGerente.setFont(new java.awt.Font("Old English Text MT", 1, 60)); // NOI18N
- lblDadosGerente.setText("Dados do Gerente");
+ lblAreaGerente.setFont(new java.awt.Font("Old London", 0, 48)); // NOI18N
+ lblAreaGerente.setText("Dados do Gerente");
btnAlterarGerente.setBackground(new java.awt.Color(255, 255, 0));
- btnAlterarGerente.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnAlterarGerente.setFont(new java.awt.Font("Old London", 1, 24)); // NOI18N
btnAlterarGerente.setText("Alterar");
btnAlterarGerente.setToolTipText("alterar os dados já existentes");
btnAlterarGerente.addActionListener(new java.awt.event.ActionListener() {
@@ -172,7 +249,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
});
btnSalvarGerente.setBackground(new java.awt.Color(0, 255, 0));
- btnSalvarGerente.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnSalvarGerente.setFont(new java.awt.Font("Old London", 1, 24)); // NOI18N
btnSalvarGerente.setText("Salvar");
btnSalvarGerente.setToolTipText("Salvar os dados");
btnSalvarGerente.addActionListener(new java.awt.event.ActionListener() {
@@ -182,7 +259,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
});
btnCancelarGerente.setBackground(new java.awt.Color(255, 0, 0));
- btnCancelarGerente.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnCancelarGerente.setFont(new java.awt.Font("Old London", 1, 24)); // NOI18N
btnCancelarGerente.setText("Cancelar");
btnCancelarGerente.setToolTipText("Cancelar a operação");
btnCancelarGerente.addActionListener(new java.awt.event.ActionListener() {
@@ -197,81 +274,82 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
- .addComponent(lblCPFGerente)
- .addGap(218, 218, 218))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
- .addComponent(lblEmailGerente)
- .addGap(209, 209, 209))))
+ .addComponent(lblEmailGerente)
+ .addGap(209, 209, 209))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtSenhaGerente, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(txtEmailGerente, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(ftxCPFGerente, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(txtNomeGerente)
+ .addComponent(txtIdGerente))
+ .addContainerGap())
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(213, 213, 213)
- .addComponent(lblNomeGerente)
- .addGap(0, 0, Short.MAX_VALUE))
- .addComponent(txtIdGerente)
+ .addGap(109, 109, 109)
+ .addComponent(lblAreaGerente))
.addGroup(jPanel1Layout.createSequentialGroup()
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(217, 217, 217)
- .addComponent(lblSenhaGerente))
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(184, 184, 184)
- .addComponent(lblIdGerente)))
- .addGap(0, 0, Short.MAX_VALUE)))
- .addContainerGap())
+ .addGap(190, 190, 190)
+ .addComponent(lblIdGerente)))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
- .addComponent(btnAlterarGerente)
- .addGap(136, 136, 136)
- .addComponent(btnSalvarGerente)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(btnCancelarGerente)
- .addGap(20, 20, 20))
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(34, 34, 34)
- .addComponent(lblDadosGerente)
- .addContainerGap(35, Short.MAX_VALUE))
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(btnAlterarGerente)
+ .addGap(136, 136, 136)
+ .addComponent(btnSalvarGerente)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 67, Short.MAX_VALUE)
+ .addComponent(btnCancelarGerente)
+ .addGap(20, 20, 20))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addGap(0, 0, Short.MAX_VALUE)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addComponent(lblNomeGerente)
+ .addGap(215, 215, 215))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addComponent(lblCPFGerente)
+ .addGap(220, 220, 220))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addComponent(lblSenhaGerente)
+ .addGap(220, 220, 220))))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
- .addComponent(lblDadosGerente)
+ .addComponent(lblAreaGerente, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(lblNomeGerente)
+ .addComponent(lblNomeGerente, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtNomeGerente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(18, 18, 18)
- .addComponent(lblCPFGerente)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(lblCPFGerente, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(ftxCPFGerente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(lblEmailGerente)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(lblEmailGerente, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtEmailGerente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(9, 9, 9)
- .addComponent(lblSenhaGerente)
- .addGap(18, 18, 18)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(lblSenhaGerente, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtSenhaGerente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(21, 21, 21)
- .addComponent(lblIdGerente)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(lblIdGerente, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtIdGerente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(30, 30, 30)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(btnAlterarGerente)
- .addComponent(btnSalvarGerente)
- .addComponent(btnCancelarGerente))
+ .addComponent(btnAlterarGerente, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnSalvarGerente, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnCancelarGerente, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(102, 102, 102))
);
- getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(90, 280, 530, 670));
+ getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 220, 530, 670));
jPanel2.setBackground(new java.awt.Color(211, 181, 143));
@@ -293,7 +371,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});
- btnNovoFuncionario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/add_icon-icons.com_74429 (2).png"))); // NOI18N
+ btnNovoFuncionario.setBackground(new java.awt.Color(51, 255, 153));
+ btnNovoFuncionario.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
btnNovoFuncionario.setText("Novo");
btnNovoFuncionario.setToolTipText("Adicionar novo funcionário");
btnNovoFuncionario.addActionListener(new java.awt.event.ActionListener() {
@@ -305,6 +384,11 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
btnBuscarFuncionario.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
btnBuscarFuncionario.setText("Buscar");
btnBuscarFuncionario.setToolTipText("Buscar pelo funcionário");
+ btnBuscarFuncionario.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnBuscarFuncionarioActionPerformed(evt);
+ }
+ });
try {
ftxCPFFuncionario.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
@@ -313,29 +397,47 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
ftxCPFFuncionario.setToolTipText("insira o CPF do funcionário");
- tblControleFuncionariosx.setModel(new javax.swing.table.DefaultTableModel(
+ tblControleFuncionarios.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null}
+ {null, null, null},
+ {null, null, null},
+ {null, null, null},
+ {null, null, null}
},
new String [] {
- "Nome", "CPF", "E-mail", "Senha", "Cód. Funcionário"
+ "Cód. Funcionário", "Nome", "CPF"
}
) {
Class[] types = new Class [] {
- java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
+ java.lang.String.class, java.lang.String.class, java.lang.String.class
+ };
+ boolean[] canEdit = new boolean [] {
+ false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
+
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return canEdit [columnIndex];
+ }
});
- tblControleFuncionariosx.setToolTipText("Tabela com os dados de funcionários");
- jScrollPane1.setViewportView(tblControleFuncionariosx);
+ tblControleFuncionarios.setToolTipText("Tabela com os dados de funcionários");
+ tblControleFuncionarios.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ tblControleFuncionariosMouseClicked(evt);
+ }
+ });
+ jScrollPane1.setViewportView(tblControleFuncionarios);
+ if (tblControleFuncionarios.getColumnModel().getColumnCount() > 0) {
+ tblControleFuncionarios.getColumnModel().getColumn(0).setPreferredWidth(3);
+ tblControleFuncionarios.getColumnModel().getColumn(1).setPreferredWidth(50);
+ tblControleFuncionarios.getColumnModel().getColumn(2).setPreferredWidth(14);
+ }
- btnSalvarFuncionario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/Save_37110.png"))); // NOI18N
+ btnSalvarFuncionario.setBackground(new java.awt.Color(0, 255, 0));
+ btnSalvarFuncionario.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
btnSalvarFuncionario.setText("Salvar");
btnSalvarFuncionario.setToolTipText("Salvar dados do funcionário");
btnSalvarFuncionario.addActionListener(new java.awt.event.ActionListener() {
@@ -344,9 +446,15 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});
- btnExcluirFuncionario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/delete_4219.png"))); // NOI18N
+ btnExcluirFuncionario.setBackground(new java.awt.Color(102, 102, 102));
+ btnExcluirFuncionario.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
btnExcluirFuncionario.setText("Excluir");
btnExcluirFuncionario.setToolTipText("excluir funcionário");
+ btnExcluirFuncionario.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnExcluirFuncionarioActionPerformed(evt);
+ }
+ });
lblControleFuncionarios.setFont(new java.awt.Font("Old English Text MT", 1, 48)); // NOI18N
lblControleFuncionarios.setText("Controle de funcionários");
@@ -376,17 +484,17 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addComponent(lblNomeFuncionario)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtNomeFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(30, 30, 30)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblCPFFuncionario)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(ftxCPFFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
- .addComponent(ftxCPFFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(29, 29, 29)
.addComponent(lblIdFuncionario)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtCodigoFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 59, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 101, Short.MAX_VALUE)
.addComponent(btnBuscarFuncionario)
- .addGap(15, 15, 15))
+ .addGap(83, 83, 83))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -397,107 +505,175 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblNomeFuncionario)
- .addComponent(lblCPFFuncionario)
- .addComponent(ftxCPFFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblIdFuncionario)
.addComponent(txtCodigoFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnBuscarFuncionario))
.addGroup(jPanel2Layout.createSequentialGroup()
- .addComponent(txtNomeFuncionario)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(txtNomeFuncionario)
+ .addComponent(lblCPFFuncionario)
+ .addComponent(ftxCPFFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(1, 1, 1)))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnNovoFuncionario)
.addComponent(btnSalvarFuncionario)
.addComponent(btnExcluirFuncionario))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 286, Short.MAX_VALUE)
- .addContainerGap())
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 241, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(60, Short.MAX_VALUE))
);
- getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(910, 220, 870, 430));
+ getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(850, 30, 980, 420));
jPanel3.setBackground(new java.awt.Color(211, 181, 143));
- jLabel2.setFont(new java.awt.Font("Old English Text MT", 1, 36)); // NOI18N
- jLabel2.setText("Controle de Clientes");
+ lblControleClientes.setFont(new java.awt.Font("Old English Text MT", 1, 36)); // NOI18N
+ lblControleClientes.setText("Controle de Clientes");
- jLabel3.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
- jLabel3.setText("Nome");
+ lblNomeCliente.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
+ lblNomeCliente.setText("Nome");
- jLabel4.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
- jLabel4.setText("CPF");
+ lblCPFCliente.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
+ lblCPFCliente.setText("CPF");
- jLabel5.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
- jLabel5.setText("Código de Cliente");
+ lblCodigoCliente.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
+ lblCodigoCliente.setText("Código de Cliente");
- jButton1.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
- jButton1.setText("Buscar");
+ btnBuscarCliente.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
+ btnBuscarCliente.setText("Buscar");
+ btnBuscarCliente.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnBuscarClienteActionPerformed(evt);
+ }
+ });
- jButton2.setText("Novo");
+ btnNovoCliente.setBackground(new java.awt.Color(51, 255, 153));
+ btnNovoCliente.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
+ btnNovoCliente.setText("Novo");
+ btnNovoCliente.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnNovoClienteActionPerformed(evt);
+ }
+ });
- jButton3.setText("Salvar");
+ btnSalvarCliente.setBackground(new java.awt.Color(0, 255, 0));
+ btnSalvarCliente.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
+ btnSalvarCliente.setText("Salvar");
+ btnSalvarCliente.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSalvarClienteActionPerformed(evt);
+ }
+ });
- jButton4.setText("Excluir");
+ btnExluirCliente.setBackground(new java.awt.Color(102, 102, 102));
+ btnExluirCliente.setFont(new java.awt.Font("Old English Text MT", 0, 18)); // NOI18N
+ btnExluirCliente.setText("Excluir");
+ btnExluirCliente.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnExluirClienteActionPerformed(evt);
+ }
+ });
+
+ tblControleClientes.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+ {null, null, null, null, null},
+ {null, null, null, null, null},
+ {null, null, null, null, null},
+ {null, null, null, null, null}
+ },
+ new String [] {
+ "Código Cliente", "Nome", "CPF", "Data Nascimento", "Endereço"
+ }
+ ) {
+ Class[] types = new Class [] {
+ java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
+ };
+ boolean[] canEdit = new boolean [] {
+ false, false, false, false, false
+ };
+
+ public Class getColumnClass(int columnIndex) {
+ return types [columnIndex];
+ }
+
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return canEdit [columnIndex];
+ }
+ });
+ jScrollPane3.setViewportView(tblControleClientes);
+ if (tblControleClientes.getColumnModel().getColumnCount() > 0) {
+ tblControleClientes.getColumnModel().getColumn(0).setPreferredWidth(3);
+ tblControleClientes.getColumnModel().getColumn(1).setPreferredWidth(50);
+ tblControleClientes.getColumnModel().getColumn(2).setPreferredWidth(14);
+ tblControleClientes.getColumnModel().getColumn(3).setPreferredWidth(10);
+ tblControleClientes.getColumnModel().getColumn(4).setPreferredWidth(100);
+ }
+
+ try {
+ txtCPFCliente.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
+ } catch (java.text.ParseException ex) {
+ ex.printStackTrace();
+ }
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jLabel2)
- .addGap(253, 253, 253))
.addGroup(jPanel3Layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jLabel3)
- .addGap(18, 18, 18)
- .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(48, 48, 48)
- .addComponent(jLabel4)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(18, 18, 18)
- .addComponent(jLabel5)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jButton1)
- .addContainerGap())
- .addGroup(jPanel3Layout.createSequentialGroup()
- .addGap(104, 104, 104)
- .addComponent(jButton2)
+ .addGap(169, 169, 169)
+ .addComponent(btnNovoCliente)
.addGap(213, 213, 213)
- .addComponent(jButton3)
+ .addComponent(btnSalvarCliente)
.addGap(143, 143, 143)
- .addComponent(jButton4)
+ .addComponent(btnExluirCliente)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(lblControleClientes)
+ .addGroup(jPanel3Layout.createSequentialGroup()
+ .addComponent(lblNomeCliente)
+ .addGap(18, 18, 18)
+ .addComponent(txtNomeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(18, 18, 18)
+ .addComponent(lblCPFCliente)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtCPFCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(lblCodigoCliente)))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtCodCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 77, Short.MAX_VALUE)
+ .addComponent(btnBuscarCliente)
+ .addGap(38, 38, 38))
+ .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING)
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
- .addComponent(jLabel2)
+ .addComponent(lblControleClientes)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel3)
- .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel4)
- .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel5)
- .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jButton1))
+ .addComponent(lblNomeCliente)
+ .addComponent(txtNomeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblCPFCliente)
+ .addComponent(lblCodigoCliente)
+ .addComponent(txtCodCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnBuscarCliente)
+ .addComponent(txtCPFCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jButton2)
- .addComponent(jButton3)
- .addComponent(jButton4))
- .addGap(0, 293, Short.MAX_VALUE))
+ .addComponent(btnNovoCliente)
+ .addComponent(btnSalvarCliente)
+ .addComponent(btnExluirCliente))
+ .addGap(18, 18, 18)
+ .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 332, Short.MAX_VALUE))
);
- getContentPane().add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(850, 670, 940, 390));
+ getContentPane().add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(780, 520, 990, 450));
- jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/ÁreaGerente.png"))); // NOI18N
- getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, -30, 1920, 1140));
+ lblBackground.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Telas/ÁreaGerente.png"))); // NOI18N
+ getContentPane().add(lblBackground, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, -30, 1920, 1140));
pack();
}// //GEN-END:initComponents
@@ -517,14 +693,23 @@ private void btnAlterarGerenteActionPerformed(java.awt.event.ActionEvent evt) {/
private void btnSalvarGerenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarGerenteActionPerformed
// TODO add your handling code here:
disableGerenteFields();
+ Gerente gerente1 = listaGerente.get(0);
+ gerente1.setNome(txtNomeGerente.getText());
+ gerente1.setCPF(ftxCPFGerente.getText());
+ gerente1.setEmail(txtEmailGerente.getText());
+ gerente1.setSenha(txtSenhaGerente.getText());
+ gerente1.setCadastroGerente(txtIdGerente.getText());
btnAlterarGerente.setEnabled(true);
btnSalvarGerente.setEnabled(false);
btnCancelarGerente.setEnabled(false);
+ JOptionPane.showMessageDialog(null, "Dados atualizados com sucesso!", "Atualização de dados", JOptionPane.INFORMATION_MESSAGE);
+
}//GEN-LAST:event_btnSalvarGerenteActionPerformed
private void btnCancelarGerenteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarGerenteActionPerformed
// TODO add your handling code here:
disableGerenteFields();
+ loadGerenteInfo();
btnAlterarGerente.setEnabled(true);
btnSalvarGerente.setEnabled(false);
btnCancelarGerente.setEnabled(false);
@@ -535,22 +720,125 @@ private void btnSalvarFuncionarioActionPerformed(java.awt.event.ActionEvent evt)
disableControleFuncionariosFields();
disableControleFuncionariosButtons();
btnNovoFuncionario.setEnabled(true);
+ JOptionPane.showMessageDialog(null, "Dados atualizados com sucesso!", "Atualização de dados", JOptionPane.INFORMATION_MESSAGE);
+
+ carregarTabelaFuncionario();
+
//btnPesquisarFuncionario.setEnabled(true);
}//GEN-LAST:event_btnSalvarFuncionarioActionPerformed
private void btnNovoFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNovoFuncionarioActionPerformed
// TODO add your handling code here:
//enableControleFuncionariosFields();
+ cadastrosFlag="funcionario";
disableControleFuncionariosButtons();
btnSalvarFuncionario.setEnabled(true);
//btnCancelarFuncionario.setEnabled(true);
- new cadastrarFuncionario().setVisible(true);
+ new cadastros().setVisible(true);
}//GEN-LAST:event_btnNovoFuncionarioActionPerformed
private void txtCodigoFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodigoFuncionarioActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtCodigoFuncionarioActionPerformed
+ private void btnSalvarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarClienteActionPerformed
+ // TODO add your handling code here:
+ JOptionPane.showMessageDialog(null, "Dados atualizados com sucesso!", "Atualização de dados", JOptionPane.INFORMATION_MESSAGE);
+
+ carregarTabelaCliente();
+ }//GEN-LAST:event_btnSalvarClienteActionPerformed
+
+ private void btnExluirClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExluirClienteActionPerformed
+ // TODO add your handling code here:
+ int i = tblControleClientes.getSelectedRow();
+
+ if (i>=0 && i=0 && i
-
+
+
-
+
-
+
+
+
+
+
@@ -46,76 +51,65 @@
+
-
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
-
+
@@ -147,13 +141,10 @@
-
-
-
+
-
@@ -281,19 +272,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/telas/cadastrarCliente.java b/src/telas/cadastrarCliente.java
index 872c649..7039f0f 100644
--- a/src/telas/cadastrarCliente.java
+++ b/src/telas/cadastrarCliente.java
@@ -1,13 +1,10 @@
-/*
- * 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 telas;
import classes.Cliente;
import static classes.Cliente.listaClientes;
import java.util.ArrayList;
import javax.swing.JOptionPane;
+
/**
*
@@ -21,10 +18,9 @@ public class cadastrarCliente extends javax.swing.JFrame {
*/
public cadastrarCliente() {
initComponents();
-
+ getRootPane().setDefaultButton(btnSalvarCliente);
setLocationRelativeTo(null);
- lblTeste.setVisible(false);
}
@@ -65,8 +61,6 @@ private void initComponents() {
ftxCPFCliente = new javax.swing.JFormattedTextField();
btnCancelarCliente = new javax.swing.JButton();
btnSalvarCliente = new javax.swing.JButton();
- lblTeste = new javax.swing.JLabel();
- btnVerify = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Cadastrar Cliente");
@@ -143,15 +137,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});
- lblTeste.setText("LabelDeTeste");
-
- btnVerify.setText("Verify");
- btnVerify.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- btnVerifyActionPerformed(evt);
- }
- });
-
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
@@ -200,12 +185,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(235, 235, 235)
.addComponent(jLabel1)))
- .addContainerGap(37, Short.MAX_VALUE))
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(72, 72, 72)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(lblTeste)
- .addComponent(btnVerify))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
@@ -233,13 +212,10 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblSenhaCliente)
.addComponent(txtSenhaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 23, Short.MAX_VALUE)
- .addComponent(lblTeste)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnCancelarCliente)
- .addComponent(btnSalvarCliente)
- .addComponent(btnVerify))
+ .addComponent(btnSalvarCliente))
.addGap(37, 37, 37))
);
@@ -247,13 +223,17 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap(276, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addContainerGap(29, Short.MAX_VALUE))
+ .addGap(184, 184, 184))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(286, Short.MAX_VALUE))
);
pack();
@@ -261,7 +241,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
private void btnSalvarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarClienteActionPerformed
// TODO add your handling code here:
-
+ boolean jaExiste = false;
if (txtNomeCliente.getText().equals("") || ftxCPFCliente.getText().equals("") ||
ftxDataCliente.getText().equals("") || txtEnderecoCliente.getText().equals("")
|| txtSenhaCliente.getText().equals("")|| txtEmailCliente.getText().equals("")
@@ -276,29 +256,29 @@ private void btnSalvarClienteActionPerformed(java.awt.event.ActionEvent evt) {//
String email = txtEmailCliente.getText();
String telefone = ftxTelefoneCliente.getText();
+ for(Cliente pessoa : listaClientes){
+ if(pessoa.getEmail().equals(email)){
+ jaExiste=true;
+ JOptionPane.showMessageDialog(null, "Já existe um cliente cadastrado com esse Email!", "Error ao criar conta", JOptionPane.ERROR_MESSAGE);
+ break;
+ }else{
+
+ }
+ }
+ if(!jaExiste){
Cliente cliente = new Cliente(nome,cpf,email,senha,endereco,nascimentoCliente,telefone);
listaClientes.add(cliente);
clearClienteInfo();
JOptionPane.showMessageDialog(null,"Cliente criado com sucesso!", "Mensagem",JOptionPane.PLAIN_MESSAGE);
this.setVisible(false);
}
+ }
}//GEN-LAST:event_btnSalvarClienteActionPerformed
private void ftxCPFClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ftxCPFClienteActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_ftxCPFClienteActionPerformed
- private void btnVerifyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVerifyActionPerformed
- // TODO add your handling code here:
- if(listaClientes.size()>0){
- lblTeste.setVisible(true);
- }else{
- lblTeste.setVisible(false);
- }
-
-
- }//GEN-LAST:event_btnVerifyActionPerformed
-
private void btnCancelarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarClienteActionPerformed
// TODO add your handling code here:
this.setVisible(false);
@@ -332,6 +312,7 @@ public static void main(String args[]) {
//
/* Create and display the form */
+
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new cadastrarCliente().setVisible(true);
@@ -342,7 +323,6 @@ public void run() {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancelarCliente;
private javax.swing.JButton btnSalvarCliente;
- private javax.swing.JButton btnVerify;
private javax.swing.JFormattedTextField ftxCPFCliente;
private javax.swing.JFormattedTextField ftxDataCliente;
private javax.swing.JFormattedTextField ftxTelefoneCliente;
@@ -354,7 +334,6 @@ public void run() {
private javax.swing.JLabel lblNomeCliente;
private javax.swing.JLabel lblSenhaCliente;
private javax.swing.JLabel lblTelefoneCliente;
- private javax.swing.JLabel lblTeste;
private javax.swing.JLabel txtDataCliente;
private javax.swing.JTextField txtEmailCliente;
private javax.swing.JTextField txtEnderecoCliente;
diff --git a/src/telas/cadastrarFuncionario.form b/src/telas/cadastrarFuncionario.form
index 118b8dc..af23a6c 100644
--- a/src/telas/cadastrarFuncionario.form
+++ b/src/telas/cadastrarFuncionario.form
@@ -49,8 +49,7 @@
-
-
+
@@ -63,7 +62,7 @@
-
+
@@ -102,14 +101,8 @@
-
-
-
-
-
-
-
-
+
+
@@ -212,25 +205,13 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/telas/cadastrarFuncionario.java b/src/telas/cadastrarFuncionario.java
index 117fb39..a811b20 100644
--- a/src/telas/cadastrarFuncionario.java
+++ b/src/telas/cadastrarFuncionario.java
@@ -26,6 +26,7 @@ public cadastrarFuncionario() {
setLocationRelativeTo(null);
limparCampos();
txtCodigoFuncionario.setEnabled(false);
+ getRootPane().setDefaultButton(btnSalvarFuncionario);
}
public void limparCampos(){
txtNomeFuncionario.setText("");
@@ -57,7 +58,6 @@ private void initComponents() {
txtCodigoFuncionario = new javax.swing.JTextField();
btnCancelarFuncionario = new javax.swing.JButton();
btnSalvarFuncionario = new javax.swing.JButton();
- btnSairFuncionario = new javax.swing.JButton();
ftxCPFFuncionario = new javax.swing.JFormattedTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
@@ -97,23 +97,14 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSalvarFuncionario.setBackground(new java.awt.Color(51, 255, 0));
btnSalvarFuncionario.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
- btnSalvarFuncionario.setText("Salvar");
- btnSalvarFuncionario.setToolTipText("Salvar funcionário");
+ btnSalvarFuncionario.setText("Criar Funcionário");
+ btnSalvarFuncionario.setToolTipText("Criar novo funcionário");
btnSalvarFuncionario.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSalvarFuncionarioActionPerformed(evt);
}
});
- btnSairFuncionario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/exit_icon-icons.com_70975.png"))); // NOI18N
- btnSairFuncionario.setText("Sair");
- btnSairFuncionario.setToolTipText("Sair do cadastro de funcionário");
- btnSairFuncionario.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- btnSairFuncionarioActionPerformed(evt);
- }
- });
-
try {
ftxCPFFuncionario.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
} catch (java.text.ParseException ex) {
@@ -129,8 +120,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
- .addComponent(btnSairFuncionario)
- .addGap(137, 137, 137)
+ .addGap(222, 222, 222)
.addComponent(lblCadastroFuncionario))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -141,7 +131,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtNomeFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(ftxCPFFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(ftxCPFFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(30, 30, 30)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
@@ -167,12 +157,8 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(lblCadastroFuncionario)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(btnSairFuncionario)))
- .addGap(31, 31, 31)
+ .addComponent(lblCadastroFuncionario)
+ .addGap(51, 51, 51)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblNomeFuncionario)
.addComponent(lblEmailFuncionario)
@@ -209,11 +195,6 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
pack();
}// //GEN-END:initComponents
- private void btnSairFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSairFuncionarioActionPerformed
- // TODO add your handling code here:
- this.setVisible(false);
- }//GEN-LAST:event_btnSairFuncionarioActionPerformed
-
private void btnSalvarFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarFuncionarioActionPerformed
// TODO add your handling code here:
if (txtNomeFuncionario.getText().equals("") || ftxCPFFuncionario.getText().equals("") ||
@@ -230,6 +211,8 @@ private void btnSalvarFuncionarioActionPerformed(java.awt.event.ActionEvent evt)
Funcionario funcionario = new Funcionario(nome,cpf,email,senha,idFuncionario);
listaFuncionarios.add(funcionario);
JOptionPane.showMessageDialog(null,"Funcionário cadastrado com sucesso!", "Mensagem",JOptionPane.PLAIN_MESSAGE);
+ limparCampos();
+ this.setVisible(false);
}
}//GEN-LAST:event_btnSalvarFuncionarioActionPerformed
@@ -276,7 +259,6 @@ public void run() {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancelarFuncionario;
- private javax.swing.JButton btnSairFuncionario;
private javax.swing.JButton btnSalvarFuncionario;
private javax.swing.JFormattedTextField ftxCPFFuncionario;
private javax.swing.JPanel jPanel1;
diff --git a/src/telas/cadastros.form b/src/telas/cadastros.form
new file mode 100644
index 0000000..31b936f
--- /dev/null
+++ b/src/telas/cadastros.form
@@ -0,0 +1,1181 @@
+
+
+
diff --git a/src/telas/cadastros.java b/src/telas/cadastros.java
new file mode 100644
index 0000000..5776fbb
--- /dev/null
+++ b/src/telas/cadastros.java
@@ -0,0 +1,1134 @@
+/*
+ * 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 telas;
+
+import classes.Cliente;
+import static classes.Cliente.listaClientes;
+import static classes.Estoque.estoque;
+import classes.Funcionario;
+import static classes.Funcionario.listaFuncionarios;
+import classes.Gerente;
+import classes.Produto;
+import static classes.Usuario.user;
+import javax.swing.JOptionPane;
+
+/**
+ *
+ * @author Yuri
+ */
+public class cadastros extends javax.swing.JFrame {
+ static String cadastrosFlag="";
+ Cliente cli = new Cliente();
+ Funcionario func = new Funcionario();
+ Gerente ger = new Gerente();
+
+ /**
+ * Creates new form cadastros
+ */
+ public cadastros() {
+ initComponents();
+ setLocationRelativeTo(null);
+ this.setExtendedState(MAXIMIZED_BOTH);
+ System.out.println("cadastros flag está como: "+cadastrosFlag);
+ desabilitarTelas();
+ inicializarTelas();
+ txtCodigoProduto.setEnabled(false);
+ txtCodigoProduto.setText(String.valueOf(estoque.size()));
+ txtCodigoFuncionario.setEnabled(false);
+ txtCodigoFuncionario.setText(String.valueOf(listaFuncionarios.size()));
+ jPanelEsqueciSenha.setVisible(false);
+ jPanelConsultarEmail.setVisible(false);
+ }
+
+ public void clearClienteInfo(){
+ txtNomeCliente.setText("");
+ ftxCPFCliente.setText("");
+ ftxDataCliente.setText("");
+ txtEnderecoCliente.setText("");
+ txtSenhaCliente.setText("");
+ txtEmailCliente.setText("");
+ ftxTelefoneCliente.setText("");
+ }
+
+ public void limparCampos(){
+ txtNomeFuncionario.setText("");
+ ftxCPFFuncionario.setText("");
+ txtEmailFuncionario.setText("");
+ txtSenhaFuncionario.setText("");
+ txtCodigoFuncionario.setText(String.valueOf(listaFuncionarios.size()));
+ }
+
+ public void desabilitarTelas(){
+ jPanelCliente.setVisible(false);
+ jPanelFuncionario.setVisible(false);
+ jPanelCriarItem.setVisible(false);
+ }
+
+ public void inicializarTelas(){
+ if(((user.equals("gerente")|| user.equals("funcionario")||user.equals("cadastro"))&&cadastrosFlag.equals("cliente"))){
+ System.out.println("User é cliente");
+ jPanelCliente.setVisible(true);
+ }
+ else if(user.equals("gerente") && cadastrosFlag.equals("funcionario")){
+ System.out.println("User é funcionário");
+ jPanelFuncionario.setVisible(true);
+ }
+ else if((user.equals("gerente")|| user.equals("funcionario")&&cadastrosFlag.equals("criarItem"))){
+ jPanelCriarItem.setVisible(true);
+ }else if(user.equals("anonimo")){
+ System.out.println("User é anônimo");
+ jPanelCliente.setVisible(true);
+ }
+ }
+
+ /**
+ * 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")
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ jPanelCriarItem = new javax.swing.JPanel();
+ jPanel6 = new javax.swing.JPanel();
+ jLabel3 = new javax.swing.JLabel();
+ jLabel4 = new javax.swing.JLabel();
+ jLabel5 = new javax.swing.JLabel();
+ jLabel6 = new javax.swing.JLabel();
+ jLabel7 = new javax.swing.JLabel();
+ jLabel8 = new javax.swing.JLabel();
+ jLabel9 = new javax.swing.JLabel();
+ txtTitulo = new javax.swing.JTextField();
+ txtAutor = new javax.swing.JTextField();
+ txtGenero = new javax.swing.JTextField();
+ txtPreco = new javax.swing.JTextField();
+ txtQuantiaEstoque = new javax.swing.JTextField();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ txtAreaDescricao = new javax.swing.JTextArea();
+ btnCriarNovoItem = new javax.swing.JButton();
+ btnCancelar = new javax.swing.JButton();
+ jLabel10 = new javax.swing.JLabel();
+ txtCodigoProduto = new javax.swing.JTextField();
+ jPanelCliente = new javax.swing.JPanel();
+ jPanel1 = new javax.swing.JPanel();
+ jLabel2 = new javax.swing.JLabel();
+ lblNomeCliente = new javax.swing.JLabel();
+ lblEmailCliente = new javax.swing.JLabel();
+ lblCPFCliente = new javax.swing.JLabel();
+ lblSenhaCliente = new javax.swing.JLabel();
+ lblEnderecoCliente = new javax.swing.JLabel();
+ lblTelefoneCliente = new javax.swing.JLabel();
+ txtNomeCliente = new javax.swing.JTextField();
+ txtEmailCliente = new javax.swing.JTextField();
+ txtSenhaCliente = new javax.swing.JTextField();
+ txtEnderecoCliente = new javax.swing.JTextField();
+ ftxTelefoneCliente = new javax.swing.JFormattedTextField();
+ txtDataCliente = new javax.swing.JLabel();
+ ftxDataCliente = new javax.swing.JFormattedTextField();
+ ftxCPFCliente = new javax.swing.JFormattedTextField();
+ btnCancelarCliente = new javax.swing.JButton();
+ btnSalvarCliente = new javax.swing.JButton();
+ jPanelFuncionario = new javax.swing.JPanel();
+ jPanel2 = new javax.swing.JPanel();
+ lblCadastroFuncionario = new javax.swing.JLabel();
+ lblNomeFuncionario = new javax.swing.JLabel();
+ lblCPFFuncionario = new javax.swing.JLabel();
+ lblEmailFuncionario = new javax.swing.JLabel();
+ lblSenhaFuncionario = new javax.swing.JLabel();
+ lblCodigoFuncionario = new javax.swing.JLabel();
+ txtNomeFuncionario = new javax.swing.JTextField();
+ txtEmailFuncionario = new javax.swing.JTextField();
+ txtSenhaFuncionario = new javax.swing.JTextField();
+ txtCodigoFuncionario = new javax.swing.JTextField();
+ btnCancelarFuncionario = new javax.swing.JButton();
+ btnSalvarFuncionario = new javax.swing.JButton();
+ ftxCPFFuncionario = new javax.swing.JFormattedTextField();
+ btnSair = new javax.swing.JButton();
+ jPanelEsqueciSenha = new javax.swing.JPanel();
+ jPanel5 = new javax.swing.JPanel();
+ jLabel11 = new javax.swing.JLabel();
+ jLabel12 = new javax.swing.JLabel();
+ jLabel13 = new javax.swing.JLabel();
+ jLabel14 = new javax.swing.JLabel();
+ txtEmail = new javax.swing.JTextField();
+ jButton1 = new javax.swing.JButton();
+ jButton2 = new javax.swing.JButton();
+ pswNovaSenha = new javax.swing.JPasswordField();
+ ftxCPFEsqueci = new javax.swing.JFormattedTextField();
+ jPanelConsultarEmail = new javax.swing.JPanel();
+ jPanel7 = new javax.swing.JPanel();
+ jLabel15 = new javax.swing.JLabel();
+ jLabel16 = new javax.swing.JLabel();
+ jLabel17 = new javax.swing.JLabel();
+ btnConsultarEmail = new javax.swing.JButton();
+ btnCancelarEmail = new javax.swing.JButton();
+ txtEmailConsulta = new javax.swing.JTextField();
+ ftxCPFConsulta = new javax.swing.JFormattedTextField();
+ jLabel18 = new javax.swing.JLabel();
+ txtNomeConsulta = new javax.swing.JTextField();
+ jLabel1 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ setTitle("Tela de cadastros");
+ setIconImage(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/adicionar.png")).getImage());
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ jPanelCriarItem.setBackground(new java.awt.Color(123, 57, 23));
+
+ jPanel6.setBackground(new java.awt.Color(248, 237, 220));
+
+ jLabel3.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
+ jLabel3.setText("Criar novo Produto no sistema");
+
+ jLabel4.setText("Título");
+
+ jLabel5.setText("Autor");
+
+ jLabel6.setText("Gênero");
+
+ jLabel7.setText("Preço");
+
+ jLabel8.setText("Quantidade Estoque");
+
+ jLabel9.setText("Descrição");
+
+ txtTitulo.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ txtTituloActionPerformed(evt);
+ }
+ });
+
+ txtAreaDescricao.setColumns(20);
+ txtAreaDescricao.setRows(5);
+ jScrollPane1.setViewportView(txtAreaDescricao);
+
+ btnCriarNovoItem.setBackground(new java.awt.Color(51, 255, 0));
+ btnCriarNovoItem.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnCriarNovoItem.setText("Criar novo Item");
+ btnCriarNovoItem.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCriarNovoItemActionPerformed(evt);
+ }
+ });
+
+ btnCancelar.setBackground(new java.awt.Color(255, 0, 0));
+ btnCancelar.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnCancelar.setText("Cancelar");
+ btnCancelar.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelarActionPerformed(evt);
+ }
+ });
+
+ jLabel10.setText("Código Produto");
+ jLabel10.setToolTipText("");
+
+ javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
+ jPanel6.setLayout(jPanel6Layout);
+ jPanel6Layout.setHorizontalGroup(
+ jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addComponent(jLabel5)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(txtAutor, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addComponent(jLabel4)
+ .addGap(29, 29, 29)
+ .addComponent(txtTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
+ .addComponent(jLabel6)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(txtGenero, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addComponent(jLabel7)
+ .addGap(97, 97, 97)
+ .addComponent(txtPreco, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel8)
+ .addComponent(jLabel9))
+ .addGap(18, 18, 18)
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(txtQuantiaEstoque)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE))))
+ .addGap(53, 68, Short.MAX_VALUE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
+ .addGap(0, 0, Short.MAX_VALUE)
+ .addComponent(jLabel3)
+ .addGap(228, 228, 228))))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jLabel10)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtCodigoProduto, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(293, 293, 293))
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addGap(172, 172, 172)
+ .addComponent(btnCriarNovoItem)
+ .addGap(195, 195, 195)
+ .addComponent(btnCancelar)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ jPanel6Layout.setVerticalGroup(
+ jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
+ .addGap(18, 18, 18)
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel10)
+ .addComponent(txtCodigoProduto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel4)
+ .addComponent(jLabel7)
+ .addComponent(txtTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(txtPreco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(25, 25, 25)
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel5)
+ .addComponent(jLabel8)
+ .addComponent(txtAutor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(txtQuantiaEstoque, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(45, 45, 45)
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel6)
+ .addComponent(jLabel9)
+ .addComponent(txtGenero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(18, 18, 18)
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnCriarNovoItem)
+ .addComponent(btnCancelar))
+ .addGap(20, 20, 20))
+ );
+
+ javax.swing.GroupLayout jPanelCriarItemLayout = new javax.swing.GroupLayout(jPanelCriarItem);
+ jPanelCriarItem.setLayout(jPanelCriarItemLayout);
+ jPanelCriarItemLayout.setHorizontalGroup(
+ jPanelCriarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelCriarItemLayout.createSequentialGroup()
+ .addGap(16, 16, 16)
+ .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(28, Short.MAX_VALUE))
+ );
+ jPanelCriarItemLayout.setVerticalGroup(
+ jPanelCriarItemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelCriarItemLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(28, Short.MAX_VALUE))
+ );
+
+ getContentPane().add(jPanelCriarItem, new org.netbeans.lib.awtextra.AbsoluteConstraints(620, 480, 840, 410));
+
+ jPanelCliente.setBackground(new java.awt.Color(123, 57, 23));
+
+ jPanel1.setBackground(new java.awt.Color(248, 237, 220));
+
+ jLabel2.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ jLabel2.setText("Cadastrar Cliente");
+
+ lblNomeCliente.setText("Nome");
+
+ lblEmailCliente.setText("Email");
+
+ lblCPFCliente.setText("CPF");
+
+ lblSenhaCliente.setText("Senha");
+
+ lblEnderecoCliente.setText("Endereço");
+
+ lblTelefoneCliente.setText("Telefone");
+
+ txtNomeCliente.setToolTipText("insira o nome do cliente");
+
+ txtEmailCliente.setToolTipText("insira o email do cliente");
+
+ txtSenhaCliente.setToolTipText("defina uma senha");
+
+ txtEnderecoCliente.setToolTipText("insira o endereço do cliente");
+
+ try {
+ ftxTelefoneCliente.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#####-####")));
+ } catch (java.text.ParseException ex) {
+ ex.printStackTrace();
+ }
+ ftxTelefoneCliente.setToolTipText("adicione o número de telefone");
+
+ txtDataCliente.setText("Data de nascimento");
+
+ try {
+ ftxDataCliente.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
+ } catch (java.text.ParseException ex) {
+ ex.printStackTrace();
+ }
+ ftxDataCliente.setToolTipText("insira a data de nascimento do cliente");
+
+ try {
+ ftxCPFCliente.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
+ } catch (java.text.ParseException ex) {
+ ex.printStackTrace();
+ }
+ ftxCPFCliente.setToolTipText("insira o CPF do cliente");
+ ftxCPFCliente.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ ftxCPFClienteActionPerformed(evt);
+ }
+ });
+
+ btnCancelarCliente.setBackground(new java.awt.Color(255, 0, 0));
+ btnCancelarCliente.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
+ btnCancelarCliente.setText("Cancelar");
+ btnCancelarCliente.setToolTipText("cancelar a operação");
+ btnCancelarCliente.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelarClienteActionPerformed(evt);
+ }
+ });
+
+ btnSalvarCliente.setBackground(new java.awt.Color(102, 255, 0));
+ btnSalvarCliente.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
+ btnSalvarCliente.setText("Salvar");
+ btnSalvarCliente.setToolTipText("Salvar dados do cliente");
+ btnSalvarCliente.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSalvarClienteActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(207, 207, 207)
+ .addComponent(jLabel2))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(151, 151, 151)
+ .addComponent(btnSalvarCliente)
+ .addGap(78, 78, 78)
+ .addComponent(btnCancelarCliente)))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(lblTelefoneCliente)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(ftxTelefoneCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap())
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(lblNomeCliente)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtNomeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(165, 165, 165)
+ .addComponent(txtDataCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(18, 18, 18)
+ .addComponent(ftxDataCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(83, 83, 83))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(lblEmailCliente)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtEmailCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(lblCPFCliente)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(ftxCPFCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(lblSenhaCliente)
+ .addGap(12, 12, 12)
+ .addComponent(txtSenhaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 125, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(lblEnderecoCliente)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtEnderecoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGap(50, 50, 50)))))
+ );
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(13, 13, 13)
+ .addComponent(jLabel2)
+ .addGap(18, 18, 18)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblNomeCliente)
+ .addComponent(txtNomeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(txtDataCliente)
+ .addComponent(ftxDataCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(9, 9, 9)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblEmailCliente)
+ .addComponent(txtEmailCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblEnderecoCliente)
+ .addComponent(txtEnderecoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblSenhaCliente)
+ .addComponent(txtSenhaCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblCPFCliente)
+ .addComponent(ftxCPFCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblTelefoneCliente)
+ .addComponent(ftxTelefoneCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(58, 58, 58)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnSalvarCliente)
+ .addComponent(btnCancelarCliente))
+ .addContainerGap(111, Short.MAX_VALUE))
+ );
+
+ javax.swing.GroupLayout jPanelClienteLayout = new javax.swing.GroupLayout(jPanelCliente);
+ jPanelCliente.setLayout(jPanelClienteLayout);
+ jPanelClienteLayout.setHorizontalGroup(
+ jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelClienteLayout.createSequentialGroup()
+ .addGap(23, 23, 23)
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 589, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(28, Short.MAX_VALUE))
+ );
+ jPanelClienteLayout.setVerticalGroup(
+ jPanelClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelClienteLayout.createSequentialGroup()
+ .addGap(15, 15, 15)
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(18, Short.MAX_VALUE))
+ );
+
+ getContentPane().add(jPanelCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 30, 640, 400));
+
+ jPanelFuncionario.setBackground(new java.awt.Color(123, 57, 23));
+
+ jPanel2.setBackground(new java.awt.Color(248, 237, 220));
+
+ lblCadastroFuncionario.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ lblCadastroFuncionario.setText("Cadastro de Funcionários");
+
+ lblNomeFuncionario.setText("Nome");
+
+ lblCPFFuncionario.setText("CPF");
+
+ lblEmailFuncionario.setText("E-mail");
+
+ lblSenhaFuncionario.setText("Senha");
+
+ lblCodigoFuncionario.setText("Código Funcionário");
+
+ txtNomeFuncionario.setToolTipText("Insira o nome do funcionário");
+
+ txtEmailFuncionario.setToolTipText("Insira o email do funcionário");
+
+ txtSenhaFuncionario.setToolTipText("Defina uma senha para o funcionário");
+
+ txtCodigoFuncionario.setToolTipText("Insira o código de funcionário");
+
+ btnCancelarFuncionario.setBackground(new java.awt.Color(255, 0, 0));
+ btnCancelarFuncionario.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnCancelarFuncionario.setText("Cancelar");
+ btnCancelarFuncionario.setToolTipText("Cancelar operação");
+ btnCancelarFuncionario.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelarFuncionarioActionPerformed(evt);
+ }
+ });
+
+ btnSalvarFuncionario.setBackground(new java.awt.Color(51, 255, 0));
+ btnSalvarFuncionario.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnSalvarFuncionario.setText("Criar Funcionário");
+ btnSalvarFuncionario.setToolTipText("Criar novo funcionário");
+ btnSalvarFuncionario.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSalvarFuncionarioActionPerformed(evt);
+ }
+ });
+
+ try {
+ ftxCPFFuncionario.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
+ } catch (java.text.ParseException ex) {
+ ex.printStackTrace();
+ }
+ ftxCPFFuncionario.setToolTipText("Insira o CPF do funcionário");
+
+ javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
+ jPanel2.setLayout(jPanel2Layout);
+ jPanel2Layout.setHorizontalGroup(
+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addGap(222, 222, 222)
+ .addComponent(lblCadastroFuncionario))
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(lblNomeFuncionario)
+ .addComponent(lblCPFFuncionario))
+ .addGap(18, 18, 18)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(txtNomeFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(ftxCPFFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(30, 30, 30)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addComponent(lblEmailFuncionario)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtEmailFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addComponent(lblSenhaFuncionario)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtSenhaFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE))))
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addGap(178, 178, 178)
+ .addComponent(btnSalvarFuncionario)))
+ .addGap(31, 31, 31)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addComponent(lblCodigoFuncionario)
+ .addGap(0, 0, 0)
+ .addComponent(txtCodigoFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(btnCancelarFuncionario))))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ jPanel2Layout.setVerticalGroup(
+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addComponent(lblCadastroFuncionario)
+ .addGap(51, 51, 51)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblNomeFuncionario)
+ .addComponent(lblEmailFuncionario)
+ .addComponent(txtNomeFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(txtEmailFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblCodigoFuncionario)
+ .addComponent(txtCodigoFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(37, 37, 37)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblCPFFuncionario)
+ .addComponent(lblSenhaFuncionario)
+ .addComponent(txtSenhaFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(ftxCPFFuncionario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(18, 18, 18)
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnSalvarFuncionario)
+ .addComponent(btnCancelarFuncionario))
+ .addContainerGap(37, Short.MAX_VALUE))
+ );
+
+ javax.swing.GroupLayout jPanelFuncionarioLayout = new javax.swing.GroupLayout(jPanelFuncionario);
+ jPanelFuncionario.setLayout(jPanelFuncionarioLayout);
+ jPanelFuncionarioLayout.setHorizontalGroup(
+ jPanelFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelFuncionarioLayout.createSequentialGroup()
+ .addGap(23, 23, 23)
+ .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGap(86, 86, 86))
+ );
+ jPanelFuncionarioLayout.setVerticalGroup(
+ jPanelFuncionarioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelFuncionarioLayout.createSequentialGroup()
+ .addGap(19, 19, 19)
+ .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(17, Short.MAX_VALUE))
+ );
+
+ getContentPane().add(jPanelFuncionario, new org.netbeans.lib.awtextra.AbsoluteConstraints(1110, 110, 770, 280));
+
+ btnSair.setFont(new java.awt.Font("Old London", 0, 48)); // NOI18N
+ btnSair.setText("Sair");
+ btnSair.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSairActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnSair, new org.netbeans.lib.awtextra.AbsoluteConstraints(1740, 20, 130, 60));
+
+ jPanelEsqueciSenha.setBackground(new java.awt.Color(123, 57, 23));
+ jPanelEsqueciSenha.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+
+ jPanel5.setBackground(new java.awt.Color(248, 237, 220));
+
+ jLabel11.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ jLabel11.setText("Esqueci Senha");
+
+ jLabel12.setText("CPF");
+
+ jLabel13.setText("Email");
+
+ jLabel14.setText("Nova senha");
+
+ jButton1.setBackground(new java.awt.Color(51, 204, 0));
+ jButton1.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ jButton1.setText("Alterar Senha");
+
+ jButton2.setBackground(new java.awt.Color(255, 0, 0));
+ jButton2.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ jButton2.setText("Cancelar");
+
+ try {
+ ftxCPFEsqueci.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
+ } catch (java.text.ParseException ex) {
+ ex.printStackTrace();
+ }
+
+ javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
+ jPanel5.setLayout(jPanel5Layout);
+ jPanel5Layout.setHorizontalGroup(
+ jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel5Layout.createSequentialGroup()
+ .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel5Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
+ .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel5Layout.createSequentialGroup()
+ .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel12)
+ .addComponent(jLabel13)
+ .addComponent(jLabel14))
+ .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel5Layout.createSequentialGroup()
+ .addGap(38, 38, 38)
+ .addComponent(pswNovaSenha, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE))))
+ .addGroup(jPanel5Layout.createSequentialGroup()
+ .addComponent(jButton1)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jButton2))))
+ .addGroup(jPanel5Layout.createSequentialGroup()
+ .addGap(89, 89, 89)
+ .addComponent(jLabel11)))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
+ .addContainerGap(116, Short.MAX_VALUE)
+ .addComponent(ftxCPFEsqueci, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap()))
+ );
+ jPanel5Layout.setVerticalGroup(
+ jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel5Layout.createSequentialGroup()
+ .addComponent(jLabel11)
+ .addGap(44, 44, 44)
+ .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(pswNovaSenha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanel5Layout.createSequentialGroup()
+ .addComponent(jLabel12)
+ .addGap(38, 38, 38)
+ .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel13)
+ .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(40, 40, 40)
+ .addComponent(jLabel14)))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 68, Short.MAX_VALUE)
+ .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jButton1)
+ .addComponent(jButton2))
+ .addGap(55, 55, 55))
+ .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel5Layout.createSequentialGroup()
+ .addGap(76, 76, 76)
+ .addComponent(ftxCPFEsqueci, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(258, Short.MAX_VALUE)))
+ );
+
+ javax.swing.GroupLayout jPanelEsqueciSenhaLayout = new javax.swing.GroupLayout(jPanelEsqueciSenha);
+ jPanelEsqueciSenha.setLayout(jPanelEsqueciSenhaLayout);
+ jPanelEsqueciSenhaLayout.setHorizontalGroup(
+ jPanelEsqueciSenhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelEsqueciSenhaLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 287, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(7, Short.MAX_VALUE))
+ );
+ jPanelEsqueciSenhaLayout.setVerticalGroup(
+ jPanelEsqueciSenhaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelEsqueciSenhaLayout.createSequentialGroup()
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(187, 187, 187))
+ );
+
+ getContentPane().add(jPanelEsqueciSenha, new org.netbeans.lib.awtextra.AbsoluteConstraints(740, 40, 300, 370));
+
+ jPanelConsultarEmail.setBackground(new java.awt.Color(123, 57, 23));
+
+ jPanel7.setBackground(new java.awt.Color(248, 237, 220));
+
+ jLabel15.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ jLabel15.setText("Consultar Email");
+
+ jLabel16.setText("CPF");
+
+ jLabel17.setText("Email");
+
+ btnConsultarEmail.setBackground(new java.awt.Color(0, 204, 0));
+ btnConsultarEmail.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnConsultarEmail.setText("Consultar Email");
+ btnConsultarEmail.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnConsultarEmailActionPerformed(evt);
+ }
+ });
+
+ btnCancelarEmail.setBackground(new java.awt.Color(255, 0, 0));
+ btnCancelarEmail.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnCancelarEmail.setText("Cancelar");
+ btnCancelarEmail.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnCancelarEmailActionPerformed(evt);
+ }
+ });
+
+ try {
+ ftxCPFConsulta.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("###.###.###-##")));
+ } catch (java.text.ParseException ex) {
+ ex.printStackTrace();
+ }
+
+ jLabel18.setText("Nome");
+
+ javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
+ jPanel7.setLayout(jPanel7Layout);
+ jPanel7Layout.setHorizontalGroup(
+ jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
+ .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addGroup(jPanel7Layout.createSequentialGroup()
+ .addComponent(jLabel17)
+ .addGap(39, 39, 39)
+ .addComponent(txtEmailConsulta))
+ .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel7Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(btnConsultarEmail)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
+ .addComponent(btnCancelarEmail))
+ .addGroup(jPanel7Layout.createSequentialGroup()
+ .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel16)
+ .addGroup(jPanel7Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel18)))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(ftxCPFConsulta)
+ .addComponent(txtNomeConsulta, javax.swing.GroupLayout.DEFAULT_SIZE, 213, Short.MAX_VALUE))))
+ .addGap(26, 26, 26))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
+ .addGap(0, 0, Short.MAX_VALUE)
+ .addComponent(jLabel15)
+ .addGap(91, 91, 91))
+ );
+ jPanel7Layout.setVerticalGroup(
+ jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel7Layout.createSequentialGroup()
+ .addComponent(jLabel15)
+ .addGap(32, 32, 32)
+ .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel16)
+ .addComponent(ftxCPFConsulta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(18, 18, 18)
+ .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel18)
+ .addComponent(txtNomeConsulta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 28, Short.MAX_VALUE)
+ .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnConsultarEmail)
+ .addComponent(btnCancelarEmail))
+ .addGap(53, 53, 53)
+ .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel17)
+ .addComponent(txtEmailConsulta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(106, 106, 106))
+ );
+
+ javax.swing.GroupLayout jPanelConsultarEmailLayout = new javax.swing.GroupLayout(jPanelConsultarEmail);
+ jPanelConsultarEmail.setLayout(jPanelConsultarEmailLayout);
+ jPanelConsultarEmailLayout.setHorizontalGroup(
+ jPanelConsultarEmailLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelConsultarEmailLayout.createSequentialGroup()
+ .addContainerGap(16, Short.MAX_VALUE)
+ .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(16, 16, 16))
+ );
+ jPanelConsultarEmailLayout.setVerticalGroup(
+ jPanelConsultarEmailLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelConsultarEmailLayout.createSequentialGroup()
+ .addGap(16, 16, 16)
+ .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(20, Short.MAX_VALUE))
+ );
+
+ getContentPane().add(jPanelConsultarEmail, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 580, -1, -1));
+
+ jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Telas/Cadastro.png"))); // NOI18N
+ jLabel1.setText("jLabel1");
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
+
+ pack();
+ }// //GEN-END:initComponents
+
+ private void ftxCPFClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ftxCPFClienteActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_ftxCPFClienteActionPerformed
+
+ private void btnCancelarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarClienteActionPerformed
+ // TODO add your handling code here:
+ this.setVisible(false);
+ }//GEN-LAST:event_btnCancelarClienteActionPerformed
+
+ private void btnSalvarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarClienteActionPerformed
+ // TODO add your handling code here:
+ boolean jaExiste = false;
+ if (txtNomeCliente.getText().equals("") || ftxCPFCliente.getText().equals("") ||
+ ftxDataCliente.getText().equals("") || txtEnderecoCliente.getText().equals("")
+ || txtSenhaCliente.getText().equals("")|| txtEmailCliente.getText().equals("")
+ || ftxTelefoneCliente.getText().equals("")){
+ JOptionPane.showMessageDialog(null,"Todos os campos devem ser inseridos!", "Mensagem",JOptionPane.PLAIN_MESSAGE);
+ }else{
+ String nome = txtNomeCliente.getText();
+ String cpf = ftxCPFCliente.getText();
+ String nascimentoCliente = ftxDataCliente.getText();
+ String endereco = txtEnderecoCliente.getText();
+ String senha = txtSenhaCliente.getText();
+ String email = txtEmailCliente.getText();
+ String telefone = ftxTelefoneCliente.getText();
+
+ for(Cliente pessoa : listaClientes){
+ if(pessoa.getEmail().equals(email)){
+ jaExiste=true;
+ JOptionPane.showMessageDialog(null, "Já existe um cliente cadastrado com esse Email!", "Error ao criar conta", JOptionPane.ERROR_MESSAGE);
+ break;
+ }else{
+
+ }
+ }
+ if(!jaExiste){
+ Cliente cliente = new Cliente(nome,cpf,email,senha,endereco,nascimentoCliente,telefone);
+ listaClientes.add(cliente);
+ clearClienteInfo();
+ JOptionPane.showMessageDialog(null,"Cliente criado com sucesso!", "Mensagem",JOptionPane.PLAIN_MESSAGE);
+ this.setVisible(false);
+ }
+ }
+ }//GEN-LAST:event_btnSalvarClienteActionPerformed
+
+ private void btnCancelarFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarFuncionarioActionPerformed
+ // TODO add your handling code here:
+ this.setVisible(false);
+ }//GEN-LAST:event_btnCancelarFuncionarioActionPerformed
+
+ private void btnSalvarFuncionarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalvarFuncionarioActionPerformed
+ // TODO add your handling code here:
+ if (txtNomeFuncionario.getText().equals("") || ftxCPFFuncionario.getText().equals("") ||
+ txtEmailFuncionario.getText().equals("") || txtSenhaFuncionario.getText().equals("")
+ || txtCodigoFuncionario.getText().equals("")){
+ JOptionPane.showMessageDialog(null,"Todos os campos devem ser inseridos!", "Mensagem",JOptionPane.PLAIN_MESSAGE);
+ }else{
+ String nome = txtNomeFuncionario.getText();
+ String cpf = ftxCPFFuncionario.getText();
+ String email = txtEmailFuncionario.getText();
+ String senha = txtSenhaFuncionario.getText();
+ String idFuncionario = txtCodigoFuncionario.getText();
+
+ Funcionario funcionario = new Funcionario(nome,cpf,email,senha,idFuncionario);
+ listaFuncionarios.add(funcionario);
+ JOptionPane.showMessageDialog(null,"Funcionário cadastrado com sucesso!", "Mensagem",JOptionPane.PLAIN_MESSAGE);
+ limparCampos();
+ this.setVisible(false);
+
+ }
+ }//GEN-LAST:event_btnSalvarFuncionarioActionPerformed
+
+ private void txtTituloActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtTituloActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_txtTituloActionPerformed
+
+ private void btnCriarNovoItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCriarNovoItemActionPerformed
+ // TODO add your handling code here:
+
+ String titulo = txtTitulo.getText();
+ String autor = txtAutor.getText();
+ String genero = txtGenero.getText();
+ double preco = Double.parseDouble(txtPreco.getText());
+ int qntEstoque = Integer.parseInt(txtQuantiaEstoque.getText());
+ String codigoProduto = txtCodigoProduto.getText();
+ String descricao = txtAreaDescricao.getText();
+
+ Produto produto1 = new Produto(titulo,autor,genero,preco,qntEstoque,codigoProduto,descricao);
+
+ estoque.add(produto1);
+ JOptionPane.showMessageDialog(null,"Item cadastrado com sucesso!", "Novo produto criado!",JOptionPane.PLAIN_MESSAGE);
+ this.setVisible(false);
+
+ }//GEN-LAST:event_btnCriarNovoItemActionPerformed
+
+ private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
+ // TODO add your handling code here:
+ this.setVisible(false);
+ }//GEN-LAST:event_btnCancelarActionPerformed
+
+ private void btnSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSairActionPerformed
+ // TODO add your handling code here:
+ this.setVisible(false);
+ }//GEN-LAST:event_btnSairActionPerformed
+
+ private void btnCancelarEmailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarEmailActionPerformed
+ // TODO add your handling code here:
+ this.setVisible(false);
+ }//GEN-LAST:event_btnCancelarEmailActionPerformed
+
+ private void btnConsultarEmailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConsultarEmailActionPerformed
+ // TODO add your handling code here:
+ /*
+ String cpf = ftxCPFConsulta.getText();
+ String nome = txtNomeConsulta.getText();
+ String ans="";
+ ans = cli.consultarEmail(cpf,nome);
+ if(ans.equals("Email não encontrado")){
+ ans = func.consultarEmail(cpf,nome);
+ txtEmailConsulta.setText(ans);//É func;
+
+
+ }else{
+ txtEmailConsulta.setText(ans);//É cliente
+ }
+ */
+ }//GEN-LAST:event_btnConsultarEmailActionPerformed
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ /* Set the Nimbus look and feel */
+ //
+ /* 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(cadastros.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (InstantiationException ex) {
+ java.util.logging.Logger.getLogger(cadastros.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (IllegalAccessException ex) {
+ java.util.logging.Logger.getLogger(cadastros.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ } catch (javax.swing.UnsupportedLookAndFeelException ex) {
+ java.util.logging.Logger.getLogger(cadastros.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
+ }
+ //
+
+ /* Create and display the form */
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new cadastros().setVisible(true);
+ }
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton btnCancelar;
+ private javax.swing.JButton btnCancelarCliente;
+ private javax.swing.JButton btnCancelarEmail;
+ private javax.swing.JButton btnCancelarFuncionario;
+ private javax.swing.JButton btnConsultarEmail;
+ private javax.swing.JButton btnCriarNovoItem;
+ private javax.swing.JButton btnSair;
+ private javax.swing.JButton btnSalvarCliente;
+ private javax.swing.JButton btnSalvarFuncionario;
+ private javax.swing.JFormattedTextField ftxCPFCliente;
+ private javax.swing.JFormattedTextField ftxCPFConsulta;
+ private javax.swing.JFormattedTextField ftxCPFEsqueci;
+ private javax.swing.JFormattedTextField ftxCPFFuncionario;
+ private javax.swing.JFormattedTextField ftxDataCliente;
+ private javax.swing.JFormattedTextField ftxTelefoneCliente;
+ private javax.swing.JButton jButton1;
+ private javax.swing.JButton jButton2;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel10;
+ private javax.swing.JLabel jLabel11;
+ private javax.swing.JLabel jLabel12;
+ private javax.swing.JLabel jLabel13;
+ private javax.swing.JLabel jLabel14;
+ private javax.swing.JLabel jLabel15;
+ private javax.swing.JLabel jLabel16;
+ private javax.swing.JLabel jLabel17;
+ private javax.swing.JLabel jLabel18;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JLabel jLabel6;
+ private javax.swing.JLabel jLabel7;
+ private javax.swing.JLabel jLabel8;
+ private javax.swing.JLabel jLabel9;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JPanel jPanel2;
+ private javax.swing.JPanel jPanel5;
+ private javax.swing.JPanel jPanel6;
+ private javax.swing.JPanel jPanel7;
+ private javax.swing.JPanel jPanelCliente;
+ private javax.swing.JPanel jPanelConsultarEmail;
+ private javax.swing.JPanel jPanelCriarItem;
+ private javax.swing.JPanel jPanelEsqueciSenha;
+ private javax.swing.JPanel jPanelFuncionario;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JLabel lblCPFCliente;
+ private javax.swing.JLabel lblCPFFuncionario;
+ private javax.swing.JLabel lblCadastroFuncionario;
+ private javax.swing.JLabel lblCodigoFuncionario;
+ private javax.swing.JLabel lblEmailCliente;
+ private javax.swing.JLabel lblEmailFuncionario;
+ private javax.swing.JLabel lblEnderecoCliente;
+ private javax.swing.JLabel lblNomeCliente;
+ private javax.swing.JLabel lblNomeFuncionario;
+ private javax.swing.JLabel lblSenhaCliente;
+ private javax.swing.JLabel lblSenhaFuncionario;
+ private javax.swing.JLabel lblTelefoneCliente;
+ private javax.swing.JPasswordField pswNovaSenha;
+ private javax.swing.JTextArea txtAreaDescricao;
+ private javax.swing.JTextField txtAutor;
+ private javax.swing.JTextField txtCodigoFuncionario;
+ private javax.swing.JTextField txtCodigoProduto;
+ private javax.swing.JLabel txtDataCliente;
+ private javax.swing.JTextField txtEmail;
+ private javax.swing.JTextField txtEmailCliente;
+ private javax.swing.JTextField txtEmailConsulta;
+ private javax.swing.JTextField txtEmailFuncionario;
+ private javax.swing.JTextField txtEnderecoCliente;
+ private javax.swing.JTextField txtGenero;
+ private javax.swing.JTextField txtNomeCliente;
+ private javax.swing.JTextField txtNomeConsulta;
+ private javax.swing.JTextField txtNomeFuncionario;
+ private javax.swing.JTextField txtPreco;
+ private javax.swing.JTextField txtQuantiaEstoque;
+ private javax.swing.JTextField txtSenhaCliente;
+ private javax.swing.JTextField txtSenhaFuncionario;
+ private javax.swing.JTextField txtTitulo;
+ // End of variables declaration//GEN-END:variables
+}
diff --git a/src/telas/carrinhosAntigos.form b/src/telas/carrinhosAntigos.form
index 4658861..3478dac 100644
--- a/src/telas/carrinhosAntigos.form
+++ b/src/telas/carrinhosAntigos.form
@@ -1,6 +1,6 @@
-
-
+
@@ -162,6 +187,9 @@
+
+
+
@@ -171,7 +199,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/telas/telaLogin.java b/src/telas/telaLogin.java
index a96db05..0da41f7 100644
--- a/src/telas/telaLogin.java
+++ b/src/telas/telaLogin.java
@@ -11,10 +11,15 @@
import classes.Gerente;
import javax.swing.JOptionPane;
//import static telas.cadastrarCliente.listaClientes;
-import static telas.Menu.logado;
-import static telas.Menu.user;
+//import static telas.Menu.logado;
+//import static telas.Menu.user;
import static telas.cadastarGerente.listaGerente;
//import telas.Menu.verificarLogin();
+import static telas.cadastros.cadastrosFlag;
+//import static classes.Cliente.usuario_tipo;
+import classes.Usuario;
+import static classes.Usuario.user;
+import static classes.Usuario.logado;
//import static telas.cadastrarFuncionario.listaFuncionarios;
@@ -30,9 +35,12 @@ public class telaLogin extends javax.swing.JFrame {
public telaLogin() {
initComponents();
setLocationRelativeTo(null);
+ this.setExtendedState(MAXIMIZED_BOTH);
+ getRootPane().setDefaultButton(btnEntrar);
+ lblConsultarEmail.setVisible(false);
+ lblEsqueciSenha.setVisible(false);
}
-
/**
* 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
@@ -47,28 +55,44 @@ private void initComponents() {
lblEmail = new javax.swing.JLabel();
txtEmail = new javax.swing.JTextField();
lblSenha = new javax.swing.JLabel();
- txtSenha = new javax.swing.JTextField();
btnEntrar = new javax.swing.JButton();
btnCancelar = new javax.swing.JButton();
lblCadastrarse = new javax.swing.JLabel();
+ pswSenha = new javax.swing.JPasswordField();
+ lblEsqueciSenha = new javax.swing.JLabel();
+ lblConsultarEmail = new javax.swing.JLabel();
+ jLabel3 = new javax.swing.JLabel();
+ jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Tela de Login");
+ setIconImage(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/login64.png")).getImage());
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ jPanel1.setOpaque(false);
- lblLogin.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
- lblLogin.setText("Bem vindo");
+ lblLogin.setFont(new java.awt.Font("Old London", 1, 60)); // NOI18N
+ lblLogin.setForeground(new java.awt.Color(255, 255, 255));
+ lblLogin.setText("Bem-vindo");
+ lblEmail.setFont(new java.awt.Font("Old London", 0, 48)); // NOI18N
+ lblEmail.setForeground(new java.awt.Color(255, 255, 255));
lblEmail.setText("E-mail");
lblEmail.setToolTipText("");
txtEmail.setToolTipText("Insira o email");
+ txtEmail.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ txtEmailActionPerformed(evt);
+ }
+ });
+ lblSenha.setFont(new java.awt.Font("Old London", 0, 48)); // NOI18N
+ lblSenha.setForeground(new java.awt.Color(255, 255, 255));
lblSenha.setText("Senha");
- txtSenha.setToolTipText("Insira a senha");
-
btnEntrar.setBackground(new java.awt.Color(51, 204, 0));
- btnEntrar.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
+ btnEntrar.setFont(new java.awt.Font("Old London", 1, 36)); // NOI18N
btnEntrar.setText("Entrar");
btnEntrar.setToolTipText("fazer login");
btnEntrar.addActionListener(new java.awt.event.ActionListener() {
@@ -78,7 +102,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
});
btnCancelar.setBackground(new java.awt.Color(255, 0, 0));
- btnCancelar.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
+ btnCancelar.setFont(new java.awt.Font("Old London", 1, 36)); // NOI18N
btnCancelar.setText("Cancelar");
btnCancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -86,6 +110,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});
+ lblCadastrarse.setFont(new java.awt.Font("Old London", 1, 30)); // NOI18N
lblCadastrarse.setForeground(new java.awt.Color(255, 102, 102));
lblCadastrarse.setText("Não tem uma conta? Cadastrar-se como cliente.");
lblCadastrarse.addMouseListener(new java.awt.event.MouseAdapter() {
@@ -94,68 +119,91 @@ public void mouseClicked(java.awt.event.MouseEvent evt) {
}
});
+ lblEsqueciSenha.setFont(new java.awt.Font("Old London", 1, 30)); // NOI18N
+ lblEsqueciSenha.setForeground(new java.awt.Color(255, 102, 102));
+ lblEsqueciSenha.setText("Esqueci a senha");
+ lblEsqueciSenha.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ lblEsqueciSenhaMouseClicked(evt);
+ }
+ });
+
+ lblConsultarEmail.setFont(new java.awt.Font("Old London", 1, 30)); // NOI18N
+ lblConsultarEmail.setForeground(new java.awt.Color(255, 102, 102));
+ lblConsultarEmail.setText("Consultar Email");
+ lblConsultarEmail.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ lblConsultarEmailMouseClicked(evt);
+ }
+ });
+
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(21, 21, 21)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(52, 52, 52)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(lblSenha)
- .addComponent(txtSenha, javax.swing.GroupLayout.PREFERRED_SIZE, 325, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(21, 21, 21)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(lblCadastrarse)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addComponent(btnEntrar)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(btnCancelar)
- .addGap(19, 19, 19)))))
- .addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 325, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(lblEmail)))
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(179, 179, 179)
- .addComponent(lblLogin)))
- .addContainerGap(79, Short.MAX_VALUE))
+ .addComponent(btnEntrar, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(207, 207, 207)
+ .addComponent(btnCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 165, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
+ .addComponent(pswSenha, javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
+ .addComponent(lblEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(lblConsultarEmail))
+ .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
+ .addComponent(lblSenha)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(lblEsqueciSenha)
+ .addGap(13, 13, 13))
+ .addComponent(txtEmail, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 502, Short.MAX_VALUE)))
+ .addGap(0, 87, Short.MAX_VALUE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(lblCadastrarse)
+ .addGap(28, 28, 28))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(163, 163, 163)
+ .addComponent(lblLogin)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(37, 37, 37)
- .addComponent(lblLogin)
- .addGap(18, 18, 18)
- .addComponent(lblEmail)
+ .addComponent(lblLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(lblEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(lblConsultarEmail, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGap(6, 6, 6)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(18, 18, 18)
- .addComponent(lblSenha)
- .addGap(5, 5, 5)
- .addComponent(txtSenha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(24, 24, 24)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblSenha, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblEsqueciSenha, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(pswSenha, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(btnEntrar)
- .addComponent(btnCancelar))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(lblCadastrarse)
- .addContainerGap(38, Short.MAX_VALUE))
+ .addComponent(btnEntrar, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(btnCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 39, Short.MAX_VALUE)
+ .addComponent(lblCadastrarse, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(37, 37, 37))
);
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(0, 0, Short.MAX_VALUE))
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- );
+ getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(1310, 220, 610, 470));
+
+ jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/logo_v3.png"))); // NOI18N
+ getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 40, 830, 780));
+
+ jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Telas/Login.png"))); // NOI18N
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
}// //GEN-END:initComponents
@@ -163,41 +211,76 @@ public void mouseClicked(java.awt.event.MouseEvent evt) {
private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed
// TODO add your handling code here:
this.setVisible(false);
+ new Menu().setVisible(true);
}//GEN-LAST:event_btnCancelarActionPerformed
private void lblCadastrarseMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblCadastrarseMouseClicked
// TODO add your handling code here:
- new cadastrarCliente().setVisible(true);
+ cadastrosFlag="cliente";
+ user="cadastro";
+ new cadastros().setVisible(true);
+ user="";
}//GEN-LAST:event_lblCadastrarseMouseClicked
private void btnEntrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEntrarActionPerformed
// TODO add your handling code here:
String emailInput = txtEmail.getText();
- String senhaInput = txtSenha.getText();
-
+ String senhaInput = String.valueOf(pswSenha.getPassword());
+ Gerente gerente = null;
+ boolean emailCorreto = false;
+ boolean senhaCorreta = false;
if(listaGerente.size()>0){
for(Gerente pessoa : listaGerente){
- if(pessoa.getEmail().equals(emailInput)&&pessoa.getSenha().equals(senhaInput)){
+ if((pessoa.getEmail().equals(emailInput)&&!pessoa.getSenha().equals(senhaInput))){
+ emailCorreto = true;
+ senhaCorreta = false;
+ }else if((!pessoa.getEmail().equals(emailInput)&&pessoa.getSenha().equals(senhaInput))){
+ emailCorreto = false;
+ senhaCorreta = true;
+
+ }else if(pessoa.getEmail().equals(emailInput)&&pessoa.getSenha().equals(senhaInput)){
+ emailCorreto = true;
+ senhaCorreta = true;
logado = true;
- user = "gerente";
- JOptionPane.showMessageDialog(null,"Entrou como gerente com sucesso!", "Notificação Login",JOptionPane.PLAIN_MESSAGE);
- this.setVisible(false);
-
+ //user = "gerente";
+ //JOptionPane.showMessageDialog(null,"Entrou como gerente com sucesso!", "Notificação Login",JOptionPane.PLAIN_MESSAGE);
+ //this.setVisible(false);
break;
}
}
+ /*
+ if (!emailCorreto && !senhaCorreta && !logado) {
+ JOptionPane.showMessageDialog(null, "Email e senha incorretos!", "Erro de Login", JOptionPane.ERROR_MESSAGE);
+ }*/
+ if(emailCorreto&&senhaCorreta&&logado){
+ user="gerente";
+ JOptionPane.showMessageDialog(null,"Entrou como gerente com sucesso!", "Notificação Login",JOptionPane.PLAIN_MESSAGE);
+ this.setVisible(false);
+ }
}
if(listaFuncionarios.size()>0){
for(Funcionario item : listaFuncionarios){
- if(item.getEmail().equals(emailInput)&& item.getSenha().equals(senhaInput)){
+ if((item.getEmail().equals(emailInput)&&!item.getSenha().equals(senhaInput))){
+ emailCorreto = true;
+ senhaCorreta = false;
+ }else if((!item.getEmail().equals(emailInput)&&item.getSenha().equals(senhaInput))){
+ emailCorreto = false;
+ senhaCorreta = true;
+
+ }else if(item.getEmail().equals(emailInput)&& item.getSenha().equals(senhaInput)){
+ emailCorreto = true;
+ senhaCorreta = true;
logado = true;
user = "funcionario";
JOptionPane.showMessageDialog(null,"Credenciais verificadas... pegando indice", "Notificação Login",JOptionPane.PLAIN_MESSAGE);
Funcionario.index_func=Integer.parseInt(item.getCadastroFuncionario());//Problema AQUI!!! -> Consertado. Bastou inicializar um índice 0 como string em cadastro Func.
JOptionPane.showMessageDialog(null,"Entrou como funcionário com sucesso!", "Notificação Login",JOptionPane.PLAIN_MESSAGE);
this.setVisible(false);
+
+
+
//verificarLogin(logado);
@@ -207,28 +290,77 @@ private void btnEntrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIR
}
if(!logado && listaClientes.size() > 0){
for(Cliente item:listaClientes){
+ if((item.getEmail().equals(emailInput)&&!item.getSenha().equals(senhaInput))){
+ emailCorreto = true;
+ senhaCorreta = false;
+ }else if((!item.getEmail().equals(emailInput)&&item.getSenha().equals(senhaInput))){
+ emailCorreto = false;
+ senhaCorreta = true;
+
+ }else if(item.getEmail().equals(emailInput)&&item.getSenha().equals(senhaInput)){
+ emailCorreto = true;
+ senhaCorreta = true;
+ logado = true;
+ user = "cliente";
+ JOptionPane.showMessageDialog(null,"Credenciais verificadas... pegando índice", "Notificação Login",JOptionPane.PLAIN_MESSAGE);
+ Cliente.index_cliente=Integer.parseInt(item.getIdCliente());//PROBLEMA AQUI DE NOVO!!
+ JOptionPane.showMessageDialog(null,"Entrou como cliente com sucesso!", "Notificação Login",JOptionPane.PLAIN_MESSAGE);
+ this.setVisible(false);
+ //user = "gerente";
+ //JOptionPane.showMessageDialog(null,"Entrou como gerente com sucesso!", "Notificação Login",JOptionPane.PLAIN_MESSAGE);
+ //this.setVisible(false);
+ break;
+
+ }
- if(item.getEmail().equals(emailInput)&& item.getSenha().equals(senhaInput)){
+ /*if(item.getEmail().equals(emailInput)&& item.getSenha().equals(senhaInput)){
+ emailCorreto = true;
+ senhaCorreta = true;
logado = true;
user = "cliente";
JOptionPane.showMessageDialog(null,"Credenciais verificadas... pegando índice", "Notificação Login",JOptionPane.PLAIN_MESSAGE);
Cliente.index_cliente=Integer.parseInt(item.getIdCliente());//PROBLEMA AQUI DE NOVO!!
JOptionPane.showMessageDialog(null,"Entrou como cliente com sucesso!", "Notificação Login",JOptionPane.PLAIN_MESSAGE);
this.setVisible(false);
- new Menu().setVisible(true);
- JPanel panel = new JPanel();
- panel.repaint();
- panel.revalidate();
+
break;
+ }*/
+ }
+ if (!emailCorreto && !senhaCorreta && !logado) {
+ JOptionPane.showMessageDialog(null, "Email ou senha incorretos!", "Erro de Login", JOptionPane.ERROR_MESSAGE);
}
+
+ /*if(emailCorreto&&senhaCorreta&&logado){
+ user="gerente";
+ JOptionPane.showMessageDialog(null,"Entrou como gerente com sucesso!", "Notificação Login",JOptionPane.PLAIN_MESSAGE);
+ this.setVisible(false);
+ }*/
}
+ if(logado){
+ new Menu().setVisible(true);
}
if(!logado){
- JOptionPane.showMessageDialog(null, "Email ou senha incorretos.", "Erro de Login", JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(null, "Email ou senha incorretos!", "Erro de Login", JOptionPane.ERROR_MESSAGE);
}
}//GEN-LAST:event_btnEntrarActionPerformed
+ private void txtEmailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtEmailActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_txtEmailActionPerformed
+
+ private void lblConsultarEmailMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblConsultarEmailMouseClicked
+ // TODO add your handling code here:
+ cadastrosFlag = "consultarEmail";
+ new cadastros().setVisible(true);
+ }//GEN-LAST:event_lblConsultarEmailMouseClicked
+
+ private void lblEsqueciSenhaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblEsqueciSenhaMouseClicked
+ // TODO add your handling code here:
+ cadastrosFlag = "esqueciSenha";
+ new cadastros().setVisible(true);
+ }//GEN-LAST:event_lblEsqueciSenhaMouseClicked
+
/**
* @param args the command line arguments
*/
@@ -267,12 +399,16 @@ public void run() {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancelar;
private javax.swing.JButton btnEntrar;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel3;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel lblCadastrarse;
+ private javax.swing.JLabel lblConsultarEmail;
private javax.swing.JLabel lblEmail;
+ private javax.swing.JLabel lblEsqueciSenha;
private javax.swing.JLabel lblLogin;
private javax.swing.JLabel lblSenha;
+ private javax.swing.JPasswordField pswSenha;
private javax.swing.JTextField txtEmail;
- private javax.swing.JTextField txtSenha;
// End of variables declaration//GEN-END:variables
}
diff --git a/src/telas/telaPagamento.form b/src/telas/telaPagamento.form
index 59498b9..638b75a 100644
--- a/src/telas/telaPagamento.form
+++ b/src/telas/telaPagamento.form
@@ -1,8 +1,16 @@
diff --git a/src/telas/telaPagamento.java b/src/telas/telaPagamento.java
index e3115d0..6589695 100644
--- a/src/telas/telaPagamento.java
+++ b/src/telas/telaPagamento.java
@@ -4,11 +4,37 @@
*/
package telas;
+import classes.Carrinho;
+//import static classes.Carrinho.listaCarrinho;
+import static classes.Carrinho.listaProdutos;
+import classes.Cliente;
+import static classes.Cliente.index_cliente;
+import static classes.Cliente.listaClientes;
+import classes.Funcionario;
+import static classes.Funcionario.index_func;
+import static classes.Funcionario.listaFuncionarios;
+import classes.Gerente;
+import classes.Pagamento;
+import classes.Pedido;
+import classes.Produto;
+import static classes.Usuario.user;
+//import static classes.Usuario.historicoCarrinhosTotais;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import javax.swing.JOptionPane;
+import static telas.Menu.historicoCarrinhosTotais;
+//import static telas.Menu.user;
+import static telas.cadastarGerente.listaGerente;
+import static telas.verCarrinho.aux;
+
/**
*
* @author Yuri
*/
public class telaPagamento extends javax.swing.JFrame {
+ Pedido pedido = new Pedido();
+ Pagamento pagamento = new Pagamento();
/**
* Creates new form telaPagamento
@@ -16,7 +42,28 @@ public class telaPagamento extends javax.swing.JFrame {
public telaPagamento() {
initComponents();
setLocationRelativeTo(null);
+ newCarregarInfoPagamento();
+
+
+ }
+
+ public void newCarregarInfoPagamento(){
+ Carrinho carrinhoSalvo = aux.get(0);
+ if(rdbPix.isSelected()){
+ double desconto = 0.95*carrinhoSalvo.getTotal();
+ txtValorTotal.setText(String.format("%.2f", desconto));
+ pagamento.setFormaPagamento("Pix");
+ }else if(rdbBoleto.isSelected()){
+ txtValorTotal.setText(String.format("%.2f", carrinhoSalvo.getTotal()));
+ pagamento.setFormaPagamento("Boleto");
+
+ }
+ txtNumCarrinho.setText(String.valueOf(carrinhoSalvo.getNumCarrinho()));
+ txtProdutos.setText(carrinhoSalvo.mostarProdutos(carrinhoSalvo.itensNoCarrinho));
+ carrinhoSalvo.setPagamento(pagamento);
+ System.out.println("Carrinho Salvo tem o pagamento de:"+pagamento.getFormaPagamento());
+ System.out.println("Carrinho salvo tem o pedido de:"+pedido.getCodPedido());
}
/**
@@ -25,9 +72,13 @@ public telaPagamento() {
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
+
// //GEN-BEGIN:initComponents
private void initComponents() {
+ buttonGroup1 = new javax.swing.ButtonGroup();
+ jPanel2 = new javax.swing.JPanel();
+ jPanel1 = new javax.swing.JPanel();
lblPagamento = new javax.swing.JLabel();
lblValorTotal = new javax.swing.JLabel();
txtValorTotal = new javax.swing.JTextField();
@@ -37,13 +88,21 @@ private void initComponents() {
lblNumCarrinho = new javax.swing.JLabel();
txtNumCarrinho = new javax.swing.JTextField();
lblProduto = new javax.swing.JLabel();
- txtProdutos = new javax.swing.JTextField();
btnPagar = new javax.swing.JButton();
btnCancelar = new javax.swing.JButton();
+ jLabel1 = new javax.swing.JLabel();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ txtProdutos = new javax.swing.JTextArea();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ setTitle("Tela pagamento");
+ setIconImage(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/sacola.png")).getImage());
+
+ jPanel2.setBackground(new java.awt.Color(123, 57, 23));
- lblPagamento.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
+ jPanel1.setBackground(new java.awt.Color(211, 181, 143));
+
+ lblPagamento.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
lblPagamento.setText("Pagamento");
lblValorTotal.setText("Valor Total");
@@ -52,9 +111,23 @@ private void initComponents() {
lblFormaPagamento.setText("Forma de pagamento");
+ buttonGroup1.add(rdbBoleto);
+ rdbBoleto.setSelected(true);
rdbBoleto.setText("Boleto");
+ rdbBoleto.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ rdbBoletoMouseClicked(evt);
+ }
+ });
+ buttonGroup1.add(rdbPix);
rdbPix.setText("Pix");
+ rdbPix.setToolTipText("Pague no pix para 5% de desconto!");
+ rdbPix.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ rdbPixMouseClicked(evt);
+ }
+ });
lblNumCarrinho.setText("Número do carrinho");
@@ -62,12 +135,17 @@ private void initComponents() {
lblProduto.setText("Produtos");
- txtProdutos.setToolTipText("seus produtos");
-
- btnPagar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/3440914-bag-basket-cart-ecommerce-pay-shopping-store_107519.png"))); // NOI18N
+ btnPagar.setBackground(new java.awt.Color(0, 204, 0));
+ btnPagar.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
btnPagar.setText("Pagar");
+ btnPagar.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnPagarActionPerformed(evt);
+ }
+ });
- btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/cancel_77947.png"))); // NOI18N
+ btnCancelar.setBackground(new java.awt.Color(255, 0, 0));
+ btnCancelar.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
btnCancelar.setText("Cancelar");
btnCancelar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -75,70 +153,118 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(167, 167, 167)
- .addComponent(lblPagamento))
- .addGroup(layout.createSequentialGroup()
- .addGap(53, 53, 53)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(btnPagar)
- .addComponent(lblFormaPagamento))
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(18, 18, 18)
- .addComponent(rdbBoleto)
- .addGap(33, 33, 33)
- .addComponent(rdbPix))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGap(71, 71, 71)
- .addComponent(btnCancelar)))))
- .addContainerGap(50, Short.MAX_VALUE))
- .addGroup(layout.createSequentialGroup()
- .addGap(72, 72, 72)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(lblValorTotal)
- .addComponent(lblNumCarrinho)
- .addComponent(lblProduto))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(txtValorTotal, javax.swing.GroupLayout.DEFAULT_SIZE, 136, Short.MAX_VALUE)
- .addComponent(txtNumCarrinho)
- .addComponent(txtProdutos))
- .addGap(38, 38, 38))
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
+ jLabel1.setForeground(new java.awt.Color(0, 153, 0));
+ jLabel1.setText("Desconto de 5% no pix!");
+
+ txtProdutos.setColumns(20);
+ txtProdutos.setRows(5);
+ jScrollPane1.setViewportView(txtProdutos);
+
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
- .addComponent(lblPagamento)
- .addGap(18, 18, 18)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(txtValorTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(lblValorTotal))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblNumCarrinho)
- .addComponent(txtNumCarrinho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(lblProduto)
- .addComponent(txtProdutos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(btnPagar)
+ .addComponent(lblFormaPagamento))
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addGap(71, 71, 71)
+ .addComponent(btnCancelar))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(18, 18, 18)
+ .addComponent(rdbBoleto)
+ .addGap(33, 33, 33)
+ .addComponent(rdbPix)))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(71, 71, 71)
+ .addComponent(jLabel1)))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(21, 21, 21)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(lblProduto)
+ .addComponent(lblValorTotal)
+ .addComponent(lblNumCarrinho))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(lblPagamento)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap())
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap(332, Short.MAX_VALUE)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addComponent(txtValorTotal)
+ .addComponent(txtNumCarrinho))
+ .addContainerGap()))
+ );
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(lblPagamento, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(lblValorTotal)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(lblNumCarrinho)
+ .addGap(18, 18, 18)
+ .addComponent(lblProduto)
+ .addGap(99, 99, 99))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(35, 35, 35)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblFormaPagamento)
.addComponent(rdbBoleto)
.addComponent(rdbPix))
- .addGap(34, 34, 34)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jLabel1)
+ .addGap(18, 18, 18)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnPagar)
.addComponent(btnCancelar))
- .addContainerGap(63, Short.MAX_VALUE))
+ .addGap(53, 53, 53))
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(38, 38, 38)
+ .addComponent(txtValorTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtNumCarrinho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(283, Short.MAX_VALUE)))
+ );
+
+ javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
+ jPanel2.setLayout(jPanel2Layout);
+ jPanel2Layout.setHorizontalGroup(
+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addGap(17, 17, 17)
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(29, Short.MAX_VALUE))
+ );
+ jPanel2Layout.setVerticalGroup(
+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
+ .addContainerGap(20, Short.MAX_VALUE)
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(16, 16, 16))
+ );
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
@@ -149,6 +275,99 @@ private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-F
this.setVisible(false);
}//GEN-LAST:event_btnCancelarActionPerformed
+ private void btnPagarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPagarActionPerformed
+ // TODO add your handling code here:
+ LocalDate today = LocalDate.now();
+
+ // Define a date format (e.g., "dd/MM/yyyy")
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
+
+ // Convert the date to a string
+ String formattedDate = today.format(formatter);
+ newCarregarInfoPagamento();
+ historicoCarrinhosTotais+=1;
+ System.out.println(historicoCarrinhosTotais);
+ if(listaProdutos.size()>0){
+ if(user.equals("cliente")){
+ Cliente cliente = listaClientes.get(index_cliente);
+ ArrayList listaCarrinhoDoCliente = cliente.getListaCarrinho();
+ int indexCarrinho = listaCarrinhoDoCliente.size();
+
+ // Clone the ArrayList
+ ArrayList clonedList = (ArrayList) listaProdutos.clone();
+ Carrinho carrinho1 = new Carrinho(indexCarrinho,formattedDate,clonedList);
+ carrinho1.setTotal(Double.parseDouble(txtValorTotal.getText()));
+ carrinho1.setPagamento(pagamento);
+ cliente.addCarrinhoLista(carrinho1);
+ //pagamento.setPedido(pedido);
+ //pedido.setCodPedido(historicoCarrinhosTotais);
+ //pagamento.setPedido(pedido);
+ pedido.setCodPedido(historicoCarrinhosTotais);
+ pagamento.setPedido(pedido);
+ carrinho1.setPagamento(pagamento);
+
+
+ }
+ if(user.equals("funcionario")){
+ Funcionario funcionario = listaFuncionarios.get(index_func);
+ ArrayList listaCarrinhoDoFuncionario = funcionario.getListaCarrinhoFuncionario();
+ int indexCarrinho = listaCarrinhoDoFuncionario.size();
+
+ ArrayList clonedList = (ArrayList) listaProdutos.clone();
+ Carrinho carrinho2 = new Carrinho(indexCarrinho,formattedDate,clonedList);
+ carrinho2.setTotal(Double.parseDouble(txtValorTotal.getText()));
+ carrinho2.setPagamento(pagamento);
+
+ funcionario.addListaCarrinhosFuncionarios(carrinho2);
+ //pagamento.setPedido(pedido);
+ pedido.setCodPedido(historicoCarrinhosTotais);
+ pagamento.setPedido(pedido);
+ carrinho2.setPagamento(pagamento);
+
+ }
+ if(user.equals("gerente")){
+ Gerente gerente = listaGerente.get(0);
+ ArrayList listaCarrinhoDoGerente = gerente.getListaCarrinhoGerente();
+ int indexCarrinho = listaCarrinhoDoGerente.size();
+
+ ArrayList clonedList = (ArrayList) listaProdutos.clone();
+ Carrinho carrinho2 = new Carrinho(indexCarrinho,formattedDate,clonedList);
+ carrinho2.setTotal(Double.parseDouble(txtValorTotal.getText()));
+ System.out.println("Lista de carrinhos do gerente é de tamanho:"+gerente.getListaCarrinhoGerente().size());
+ carrinho2.setPagamento(pagamento);
+
+
+ gerente.addListaCarrinhosGerente(carrinho2);
+ System.out.println("Adicionado. Tamanho agora é:"+gerente.getListaCarrinhoGerente());
+ pedido.setCodPedido(historicoCarrinhosTotais);
+ pagamento.setPedido(pedido);
+ carrinho2.setPagamento(pagamento);
+
+ }
+ System.out.println();
+
+ listaProdutos.clear();
+ aux.clear();
+ System.out.println("Adicionado ao Histórico!");
+
+ }
+ JOptionPane.showMessageDialog(null,"Compra realizada com sucesso!","Notificação de compra!",JOptionPane.INFORMATION_MESSAGE);
+ this.setVisible(false);
+
+
+ //listaProdutos.clear();
+ }//GEN-LAST:event_btnPagarActionPerformed
+
+ private void rdbPixMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_rdbPixMouseClicked
+ // TODO add your handling code here:
+ newCarregarInfoPagamento();
+ }//GEN-LAST:event_rdbPixMouseClicked
+
+ private void rdbBoletoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_rdbBoletoMouseClicked
+ // TODO add your handling code here:
+ newCarregarInfoPagamento();
+ }//GEN-LAST:event_rdbBoletoMouseClicked
+
/**
* @param args the command line arguments
*/
@@ -187,6 +406,11 @@ public void run() {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnCancelar;
private javax.swing.JButton btnPagar;
+ private javax.swing.ButtonGroup buttonGroup1;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JPanel jPanel2;
+ private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JLabel lblFormaPagamento;
private javax.swing.JLabel lblNumCarrinho;
private javax.swing.JLabel lblPagamento;
@@ -195,7 +419,7 @@ public void run() {
private javax.swing.JRadioButton rdbBoleto;
private javax.swing.JRadioButton rdbPix;
private javax.swing.JTextField txtNumCarrinho;
- private javax.swing.JTextField txtProdutos;
+ private javax.swing.JTextArea txtProdutos;
private javax.swing.JTextField txtValorTotal;
// End of variables declaration//GEN-END:variables
}
diff --git a/src/telas/verCarrinho.form b/src/telas/verCarrinho.form
index baaf9d5..f592aa6 100644
--- a/src/telas/verCarrinho.form
+++ b/src/telas/verCarrinho.form
@@ -4,6 +4,9 @@
+
+
+
@@ -19,183 +22,582 @@
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
-
+
-
-
+
+
-
+
+
+
+
+
+
-
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/telas/verCarrinho.java b/src/telas/verCarrinho.java
index d80c428..404f458 100644
--- a/src/telas/verCarrinho.java
+++ b/src/telas/verCarrinho.java
@@ -4,11 +4,41 @@
*/
package telas;
+import classes.Carrinho;
+import classes.Usuario;
+//import classes.Usuario.listaCarrinho;
+import static classes.Carrinho.listaProdutos;
+import classes.Cliente;
+import static classes.Cliente.index_cliente;
+import static classes.Cliente.listaClientes;
+import static classes.Estoque.estoque;
+import classes.Funcionario;
+import static classes.Funcionario.index_func;
+import static classes.Funcionario.listaFuncionarios;
+import classes.Gerente;
+import classes.Produto;
+import static classes.Usuario.user;
+import java.util.ArrayList;
+import java.util.Vector;
+import javax.swing.JOptionPane;
+import javax.swing.table.DefaultTableModel;
+//import static telas.Menu.user;
+import static telas.cadastarGerente.listaGerente;
+
/**
*
* @author Yuri
*/
public class verCarrinho extends javax.swing.JFrame {
+ Cliente cliente = listaClientes.get(index_cliente);//Pegando o ID do cliente
+ Funcionario funcionario = listaFuncionarios.get(index_func);
+ Gerente gerente = listaGerente.get(0);
+ ArrayList listaCarrinhoDoCliente = cliente.getListaCarrinho();//Pegando a lista de carrinhos do cliente
+ int indexCarrinho = listaCarrinhoDoCliente.size();//Pegando o tamanho da lista de carrinhos do cliente
+ Carrinho carrinho1 = new Carrinho(indexCarrinho,"29/08/2024");//Criando um novo carrinho vazio de itens com o índice definido na linha anterior
+ public static Vector aux = new Vector<>(1); // Initializes a Vector with an initial capacity of 1
+
+
/**
* Creates new form verCarrinho
@@ -16,9 +46,202 @@ public class verCarrinho extends javax.swing.JFrame {
public verCarrinho() {
initComponents();
setLocationRelativeTo(null);
+ carregarTabelaProdutos();
+ btnRemoverItem.setEnabled(false);
+ this.setExtendedState(MAXIMIZED_BOTH);
+ jPanel4.setVisible(false);
+ disableCarrinhoFields();
+ System.out.println("User é igual a "+user);
+ if(listaProdutos.size()!=0){
+ btnEsvaziarCarrinho.setEnabled(true);
+ }else{
+ btnEsvaziarCarrinho.setEnabled(false);
+ }
+ carregarTabelaCliente();
+
+ }
+
+
+ //Carregar a tabela com os funcionários da lista
+ private void carregarTabelaProdutos() {
+ DefaultTableModel modeloTabelaProdutos = new DefaultTableModel(new Object[] {"Titulo","Autor","Preço","Quantidade","Gênero"},0);
+
+ for(int i=0;i listaCarrinhoDoCliente = cliente.getListaCarrinho();
+ System.out.println("Tamanho da lista: "+cliente.getListaCarrinho().size());
+ System.out.println("ListaResgatada");
+
+ for(int i=0;i listaCarrinhoDoFuncionario = funcionario.getListaCarrinhoFuncionario();
+
+
+ System.out.println("Funcionário passado");
+ System.out.println("Tamanho da lista: "+funcionario.getListaCarrinhoFuncionario().size());
+ System.out.println("ListaResgatada");
+ System.out.println("Quantidade de itens no carrinho:"+funcionario.getListaCarrinhoFuncionario().size());
+ for(int i=0;i listaCarrinhoDoFuncionario = gerente.getListaCarrinhoGerente();
+
+
+ System.out.println("Funcionário passado");
+ System.out.println("Tamanho da lista: "+gerente.getListaCarrinhoGerente().size());
+ System.out.println("ListaResgatada");
+ System.out.println("Quantidade de itens no carrinho:"+gerente.getListaCarrinhoGerente().size());
+ for(int i=0;i//GEN-BEGIN:initComponents
private void initComponents() {
+ jPanel2 = new javax.swing.JPanel();
+ jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
tblProdutos = new javax.swing.JTable();
btnRemoverItem = new javax.swing.JButton();
@@ -35,10 +260,35 @@ private void initComponents() {
lblProdutosCarrinho = new javax.swing.JLabel();
btnConfirmarCompra = new javax.swing.JButton();
lblVisualizarCarrinho = new javax.swing.JLabel();
+ btnVerCarrinhosAntigos = new javax.swing.JButton();
+ jPanel4 = new javax.swing.JPanel();
+ jPanel5 = new javax.swing.JPanel();
+ jPanel6 = new javax.swing.JPanel();
+ jScrollPane2 = new javax.swing.JScrollPane();
+ tblCliente = new javax.swing.JTable();
+ lblCarrinhosAnteriores = new javax.swing.JLabel();
+ lblNumCarrinho = new javax.swing.JLabel();
+ lblData = new javax.swing.JLabel();
+ lblProdutos = new javax.swing.JLabel();
+ lblTotal = new javax.swing.JLabel();
+ txtNumCarrinho = new javax.swing.JTextField();
+ txtTotal = new javax.swing.JTextField();
+ txtData = new javax.swing.JFormattedTextField();
+ jScrollPane3 = new javax.swing.JScrollPane();
+ txtProdutos = new javax.swing.JTextArea();
jButton1 = new javax.swing.JButton();
+ btnSair = new javax.swing.JButton();
+ jLabel1 = new javax.swing.JLabel();
+ jPanel3 = new javax.swing.JPanel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Visualizar meu carrinho");
+ setIconImage(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/carrinho64.png")).getImage());
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
+
+ jPanel2.setBackground(new java.awt.Color(99, 83, 39));
+
+ jPanel1.setBackground(new java.awt.Color(208, 174, 83));
tblProdutos.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
@@ -48,26 +298,53 @@ private void initComponents() {
{null, null, null, null, null}
},
new String [] {
- "Título", "Preço", "Quantidade", "Cód. Produto", "Descrição"
+ "Título", "Autor", "Preço", "Quantidade", "Gênero"
}
) {
Class[] types = new Class [] {
- java.lang.String.class, java.lang.Double.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class
+ java.lang.String.class, java.lang.String.class, java.lang.Double.class, java.lang.Integer.class, java.lang.String.class
+ };
+ boolean[] canEdit = new boolean [] {
+ false, true, false, false, false
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
+
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return canEdit [columnIndex];
+ }
+ });
+ tblProdutos.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ tblProdutosMouseClicked(evt);
+ }
});
jScrollPane1.setViewportView(tblProdutos);
btnRemoverItem.setBackground(new java.awt.Color(153, 153, 153));
btnRemoverItem.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
btnRemoverItem.setText("Remover item");
+ btnRemoverItem.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ btnRemoverItemMouseClicked(evt);
+ }
+ });
+ btnRemoverItem.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnRemoverItemActionPerformed(evt);
+ }
+ });
btnEsvaziarCarrinho.setBackground(new java.awt.Color(255, 0, 0));
btnEsvaziarCarrinho.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
btnEsvaziarCarrinho.setText("Esvaziar carrinho");
+ btnEsvaziarCarrinho.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnEsvaziarCarrinhoActionPerformed(evt);
+ }
+ });
lblProdutosCarrinho.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
lblProdutosCarrinho.setText("Meus produtos no carrinho");
@@ -84,75 +361,455 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
lblVisualizarCarrinho.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N
lblVisualizarCarrinho.setText("Visualizar Carrinho Atual");
- jButton1.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
- jButton1.setText("Ver carrinhos antigos");
- jButton1.addActionListener(new java.awt.event.ActionListener() {
+ btnVerCarrinhosAntigos.setBackground(new java.awt.Color(91, 255, 128));
+ btnVerCarrinhosAntigos.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnVerCarrinhosAntigos.setText("Ver carrinhos antigos");
+ btnVerCarrinhosAntigos.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton1ActionPerformed(evt);
+ btnVerCarrinhosAntigosActionPerformed(evt);
}
});
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
- .addGroup(layout.createSequentialGroup()
- .addComponent(lblProdutosCarrinho)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jButton1))
- .addGroup(layout.createSequentialGroup()
- .addGap(6, 6, 6)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(6, 6, 6)
- .addComponent(btnRemoverItem)
- .addGap(136, 136, 136)
- .addComponent(btnEsvaziarCarrinho)
- .addGap(106, 106, 106)
- .addComponent(btnConfirmarCompra))
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 762, javax.swing.GroupLayout.PREFERRED_SIZE)))))
- .addGroup(layout.createSequentialGroup()
- .addGap(250, 250, 250)
- .addComponent(lblVisualizarCarrinho)))
- .addContainerGap(48, Short.MAX_VALUE))
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addContainerGap(590, Short.MAX_VALUE)
+ .addComponent(btnVerCarrinhosAntigos)
+ .addGap(16, 16, 16))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(264, 264, 264)
+ .addComponent(lblVisualizarCarrinho)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(lblProdutosCarrinho, javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(6, 6, 6)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(6, 6, 6)
+ .addComponent(btnRemoverItem)
+ .addGap(136, 136, 136)
+ .addComponent(btnEsvaziarCarrinho)
+ .addGap(106, 106, 106)
+ .addComponent(btnConfirmarCompra))
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 762, javax.swing.GroupLayout.PREFERRED_SIZE))))
+ .addContainerGap()))
);
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(lblVisualizarCarrinho)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addGap(39, 39, 39)
+ .addComponent(btnVerCarrinhosAntigos)
+ .addContainerGap(368, Short.MAX_VALUE))
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(71, 71, 71)
.addComponent(lblProdutosCarrinho)
- .addComponent(jButton1))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(btnRemoverItem)
+ .addComponent(btnEsvaziarCarrinho)
+ .addComponent(btnConfirmarCompra))
+ .addContainerGap(48, Short.MAX_VALUE)))
+ );
+
+ javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
+ jPanel2.setLayout(jPanel2Layout);
+ jPanel2Layout.setHorizontalGroup(
+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(17, Short.MAX_VALUE))
+ );
+ jPanel2Layout.setVerticalGroup(
+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(13, Short.MAX_VALUE))
+ );
+
+ getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 10, 840, 490));
+
+ jPanel4.setBackground(new java.awt.Color(99, 83, 39));
+
+ jPanel5.setBackground(new java.awt.Color(209, 176, 84));
+
+ jPanel6.setBackground(new java.awt.Color(208, 174, 83));
+
+ tblCliente.setModel(new javax.swing.table.DefaultTableModel(
+ new Object [][] {
+ {null, null, null, null, null},
+ {null, null, null, null, null},
+ {null, null, null, null, null},
+ {null, null, null, null, null}
+ },
+ new String [] {
+ "NumCarrinho", "Data do pedido", "Produtos", "Total", "Forma Pagamento"
+ }
+ ) {
+ Class[] types = new Class [] {
+ java.lang.Integer.class, java.lang.String.class, java.lang.Object.class, java.lang.Double.class, java.lang.String.class
+ };
+ boolean[] canEdit = new boolean [] {
+ false, false, false, false, false
+ };
+
+ public Class getColumnClass(int columnIndex) {
+ return types [columnIndex];
+ }
+
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return canEdit [columnIndex];
+ }
+ });
+ tblCliente.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ tblClienteMouseClicked(evt);
+ }
+ });
+ jScrollPane2.setViewportView(tblCliente);
+
+ lblCarrinhosAnteriores.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ lblCarrinhosAnteriores.setText("Consultar Carrinhos Antigos");
+
+ lblNumCarrinho.setText("NumCarrinho");
+
+ lblData.setText("Data");
+
+ lblProdutos.setText("Produtos");
+
+ lblTotal.setText("Total");
+
+ txtNumCarrinho.setToolTipText("número do carrinho");
+
+ txtTotal.setToolTipText("valor total");
+
+ try {
+ txtData.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##/##/####")));
+ } catch (java.text.ParseException ex) {
+ ex.printStackTrace();
+ }
+ txtData.setToolTipText("data do pedido");
+
+ txtProdutos.setColumns(20);
+ txtProdutos.setRows(5);
+ jScrollPane3.setViewportView(txtProdutos);
+
+ jButton1.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
+ jButton1.setText("Fechar janela");
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton1ActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
+ jPanel6.setLayout(jPanel6Layout);
+ jPanel6Layout.setHorizontalGroup(
+ jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addGap(384, 384, 384)
+ .addComponent(lblCarrinhosAnteriores)
+ .addGap(130, 130, 130)
+ .addComponent(jButton1))
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addGap(24, 24, 24)
+ .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 885, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addGap(35, 35, 35)
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addComponent(lblTotal)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(175, 175, 175)
+ .addComponent(lblProdutos)
+ .addGap(18, 18, 18)
+ .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 419, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addComponent(lblNumCarrinho)
+ .addGap(18, 18, 18)
+ .addComponent(txtNumCarrinho, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(70, 70, 70)
+ .addComponent(lblData)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtData, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)))))
+ .addContainerGap(229, Short.MAX_VALUE))
+ );
+ jPanel6Layout.setVerticalGroup(
+ jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel6Layout.createSequentialGroup()
+ .addGap(18, 18, 18)
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(lblCarrinhosAnteriores)
+ .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(btnRemoverItem)
- .addComponent(btnEsvaziarCarrinho)
- .addComponent(btnConfirmarCompra))
- .addContainerGap(63, Short.MAX_VALUE))
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblNumCarrinho)
+ .addComponent(txtNumCarrinho, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblData)
+ .addComponent(txtData, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lblProdutos)
+ .addComponent(lblTotal)
+ .addComponent(txtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(63, 63, 63)
+ .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 266, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(28, 28, 28))
+ );
+
+ javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
+ jPanel5.setLayout(jPanel5Layout);
+ jPanel5Layout.setHorizontalGroup(
+ jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel5Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(19, Short.MAX_VALUE))
+ );
+ jPanel5Layout.setVerticalGroup(
+ jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel5Layout.createSequentialGroup()
+ .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, 488, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(0, 12, Short.MAX_VALUE))
+ );
+
+ javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
+ jPanel4.setLayout(jPanel4Layout);
+ jPanel4Layout.setHorizontalGroup(
+ jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel4Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
+ jPanel4Layout.setVerticalGroup(
+ jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
+ .addContainerGap(14, Short.MAX_VALUE)
+ .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap())
+ );
+
+ getContentPane().add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(860, 390, 1000, 520));
+
+ btnSair.setBackground(new java.awt.Color(255, 51, 0));
+ btnSair.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
+ btnSair.setText("Sair");
+ btnSair.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSairActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnSair, new org.netbeans.lib.awtextra.AbsoluteConstraints(1540, 50, -1, 40));
+
+ jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/Telas/VerCarrinho.png"))); // NOI18N
+ jLabel1.setToolTipText("");
+ getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
+
+ jPanel3.setBackground(new java.awt.Color(99, 83, 39));
+
+ javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
+ jPanel3.setLayout(jPanel3Layout);
+ jPanel3Layout.setHorizontalGroup(
+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 840, Short.MAX_VALUE)
+ );
+ jPanel3Layout.setVerticalGroup(
+ jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 490, Short.MAX_VALUE)
+ );
+
+ getContentPane().add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 150, 840, 490));
pack();
}// //GEN-END:initComponents
private void btnConfirmarCompraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConfirmarCompraActionPerformed
// TODO add your handling code here:
- new telaPagamento().setVisible(true);
+ if(listaProdutos.size()>0){
+ carrinho1.setItensNoCarrinho(listaProdutos);
+ carrinho1.contarSaldo();
+ aux.add(carrinho1);
+ new telaPagamento().setVisible(true);
+ }else{
+ JOptionPane.showMessageDialog(null, "Adicione algum item ao carrinho!", "Error ao acessar o pagamento", JOptionPane.ERROR_MESSAGE);
+ }
+ carregarTabelaProdutos();
+
+ //}
+
}//GEN-LAST:event_btnConfirmarCompraActionPerformed
+ private void btnVerCarrinhosAntigosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVerCarrinhosAntigosActionPerformed
+ // TODO add your handling code here:
+ //new carrinhosAntigos().setVisible(true);
+ carregarTabelaProdutos();
+ if(user.equals("cliente")){
+ carregarTabelaCliente();
+ }
+ if(user.equals("funcionario")){
+ carregarTabelaFuncionarioPedidos();
+ }
+ if(user.equals("gerente")){
+ carregarTabelaGerentePedidos();
+ }
+ jPanel4.setVisible(true);
+ }//GEN-LAST:event_btnVerCarrinhosAntigosActionPerformed
+
+ private void btnEsvaziarCarrinhoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnEsvaziarCarrinhoActionPerformed
+ // Get the total number of rows in the table
+ int rowCount = tblProdutos.getRowCount();
+
+ for (int row = 0; row < rowCount; row++) { // Loop until rowCount - 1
+ // Get the name of the product from the current row
+ Object produtoPesquisado = tblProdutos.getValueAt(row, 0);
+ String inputBusca = String.valueOf(produtoPesquisado);
+
+ // Get the quantity of the product from the current row
+ Object quantPesquisado = tblProdutos.getValueAt(row, 3);
+
+ if (quantPesquisado == null) {
+ continue; // Skip this row if quantity is null
+ }
+
+ String quantBuscastr = String.valueOf(quantPesquisado);
+ int quantBusca = Integer.parseInt(quantBuscastr);
+
+ // Find the corresponding item in stock and update the quantity
+ for (Produto itemEstoque : estoque) {
+ if (itemEstoque.getTitulo().equals(inputBusca)) {
+ itemEstoque.setQuantidadeEstoque(itemEstoque.getQuantidadeEstoque() + quantBusca);
+ }
+ }
+ }
+
+ // Clear the list of products
+ listaProdutos.clear();
+
+ // Reload the product table
+ carregarTabelaProdutos();
+ }//GEN-LAST:event_btnEsvaziarCarrinhoActionPerformed
+
+ private void btnRemoverItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoverItemActionPerformed
+ // TODO add your handling code here:
+ int row = tblProdutos.getSelectedRow();
+
+ //pega o nome do produto
+ Object produtoPesquisado = tblProdutos.getValueAt(row,0);
+ String inputBusca = String.valueOf(produtoPesquisado);
+ //pega a quantidade do produto
+ Object quantPesquisado = tblProdutos.getValueAt(row,3);
+ String quantBuscastr = String.valueOf(quantPesquisado);
+ int quantBusca = Integer.parseInt(quantBuscastr);
+
+ for(Produto itemEstoque : estoque){
+ if(itemEstoque.getTitulo().equals(inputBusca)){
+ Produto item = itemEstoque;
+ item.setQuantidadeEstoque(item.getQuantidadeEstoque()+quantBusca);
+ }
+ }
+ listaProdutos.remove(row);
+ //listaProdutos.clear();
+ carregarTabelaProdutos();
+ }//GEN-LAST:event_btnRemoverItemActionPerformed
+
+ private void btnRemoverItemMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnRemoverItemMouseClicked
+ // TODO add your handling code here:
+ int indiceItem = tblProdutos.getSelectedColumn();
+ if (indiceItem>=0 && indiceItem
+
+
+
+
@@ -18,139 +22,142 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
-
-
+
+
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
+
+
+
+
+
-
+
+
+
+
@@ -158,17 +165,49 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -180,15 +219,18 @@
-
+
-
+
-
-
+
+
+
+
+
@@ -198,16 +240,72 @@
-
-
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/telas/verProdutos.java b/src/telas/verProdutos.java
index 7d8494e..6201a62 100644
--- a/src/telas/verProdutos.java
+++ b/src/telas/verProdutos.java
@@ -1,20 +1,36 @@
-/*
- * 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 telas;
+import classes.Carrinho;
+import static classes.Carrinho.listaProdutos;
+import static classes.Estoque.estoque;
+import classes.Produto;
+import static classes.Usuario.logado;
+import java.util.Vector;
+import javax.swing.JOptionPane;
+import javax.swing.table.DefaultTableModel;
+//import static telas.Menu.logado;
+
/**
*
* @author v
*/
public class verProdutos extends javax.swing.JFrame {
-
+ public static Vector auxProduto = new Vector<>(1);
/**
* Creates new form verProdutos
*/
public verProdutos() {
initComponents();
+ setLocationRelativeTo(null);
+ getRootPane().setDefaultButton(btnPesquisar);
+ this.setExtendedState(MAXIMIZED_BOTH);
+ carregarTabelaProdutos();
+ txtQuantidade.setText("1");
+ Produto item;
+ btnSobre.setEnabled(false);
+ Produto produto1 = estoque.get(0);
+ auxProduto.add(produto1);
}
/**
@@ -22,38 +38,83 @@ public verProdutos() {
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
+ private void carregarTabelaProdutos(){
+ DefaultTableModel modeloTabelaProdutos = new DefaultTableModel(new Object[] {"Titulo","Autor","Gênero","Valor","Quant.Estoque"},0);
+
+ for(int i=0;i//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
- jScrollPane1 = new javax.swing.JScrollPane();
- Pesquisa = new javax.swing.JTextArea();
- lblProdutos = new javax.swing.JLabel();
+ titulo = new javax.swing.JLabel();
btnPesquisar = new javax.swing.JButton();
- jScrollPane2 = new javax.swing.JScrollPane();
+ Tabela = new javax.swing.JScrollPane();
tabela_produtos = new javax.swing.JTable();
lblResultadosPesquisa = new javax.swing.JLabel();
lblNome = new javax.swing.JLabel();
btnSobre = new javax.swing.JButton();
btnComprar = new javax.swing.JButton();
+ jLabel1 = new javax.swing.JLabel();
+ txtQuantidade = new javax.swing.JTextField();
+ txtTitulo = new javax.swing.JTextField();
+ lblAutor = new javax.swing.JLabel();
+ txtAutor = new javax.swing.JTextField();
+ btnSair = new javax.swing.JButton();
+ jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ setTitle("Busca por produtos");
+ setIconImage(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/pesquisar64.png")).getImage());
+ getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
- Pesquisa.setColumns(20);
- Pesquisa.setRows(5);
- jScrollPane1.setViewportView(Pesquisa);
+ jPanel1.setBackground(new java.awt.Color(237, 224, 182));
+ jPanel1.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ jPanel1MouseClicked(evt);
+ }
+ });
- lblProdutos.setFont(new java.awt.Font("Inter", 1, 24)); // NOI18N
- lblProdutos.setText("Produtos");
+ titulo.setFont(new java.awt.Font("Old London", 0, 36)); // NOI18N
+ titulo.setText("Pesquisar por produtos");
+ titulo.setToolTipText("");
+ btnPesquisar.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
btnPesquisar.setText("Pesquisar");
+ btnPesquisar.setToolTipText("Pesquisar por título ou autor");
btnPesquisar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnPesquisarActionPerformed(evt);
}
});
+ Tabela.addFocusListener(new java.awt.event.FocusAdapter() {
+ public void focusGained(java.awt.event.FocusEvent evt) {
+ TabelaFocusGained(evt);
+ }
+ });
+
tabela_produtos.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null},
@@ -68,19 +129,39 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Float.class, java.lang.Integer.class
};
+ boolean[] canEdit = new boolean [] {
+ false, false, false, false, false
+ };
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
+
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return canEdit [columnIndex];
+ }
});
- jScrollPane2.setViewportView(tabela_produtos);
+ tabela_produtos.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ tabela_produtosMouseClicked(evt);
+ }
+ });
+ Tabela.setViewportView(tabela_produtos);
+ if (tabela_produtos.getColumnModel().getColumnCount() > 0) {
+ tabela_produtos.getColumnModel().getColumn(0).setResizable(false);
+ tabela_produtos.getColumnModel().getColumn(1).setResizable(false);
+ tabela_produtos.getColumnModel().getColumn(2).setResizable(false);
+ tabela_produtos.getColumnModel().getColumn(3).setResizable(false);
+ tabela_produtos.getColumnModel().getColumn(4).setResizable(false);
+ }
lblResultadosPesquisa.setText("Resultados da pesquisa");
- lblNome.setFont(new java.awt.Font("Inter", 0, 14)); // NOI18N
- lblNome.setText("Nome:");
+ lblNome.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ lblNome.setText("Titulo:");
- btnSobre.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/information_info_1565.png"))); // NOI18N
+ btnSobre.setBackground(new java.awt.Color(0, 102, 204));
+ btnSobre.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
btnSobre.setText("Sobre");
btnSobre.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
@@ -88,14 +169,27 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
}
});
- btnComprar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/simbolos/accept_icon-icons.com_74428.png"))); // NOI18N
- btnComprar.setText("Comprar");
+ btnComprar.setBackground(new java.awt.Color(51, 204, 0));
+ btnComprar.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
+ btnComprar.setText("Adicionar ao carrinho");
btnComprar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnComprarActionPerformed(evt);
}
});
+ jLabel1.setFont(new java.awt.Font("Old London", 0, 18)); // NOI18N
+ jLabel1.setText("Quantidade");
+
+ txtQuantidade.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ txtQuantidadeActionPerformed(evt);
+ }
+ });
+
+ lblAutor.setFont(new java.awt.Font("Old London", 0, 24)); // NOI18N
+ lblAutor.setText("Autor");
+
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
@@ -103,93 +197,256 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(58, 58, 58)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 483, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(18, 18, 18)
- .addComponent(btnPesquisar))
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(70, 70, 70)
- .addComponent(lblNome))
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(149, 149, 149)
- .addComponent(btnSobre)
- .addGap(199, 199, 199)
- .addComponent(btnComprar))
+ .addGap(27, 27, 27)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(titulo)
+ .addComponent(txtTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, 493, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(jLabel1)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtQuantidade, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(122, 122, 122)
+ .addComponent(btnSobre)
+ .addGap(199, 199, 199)
+ .addComponent(btnComprar))
+ .addComponent(Tabela, javax.swing.GroupLayout.PREFERRED_SIZE, 653, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblNome)
+ .addComponent(txtAutor, javax.swing.GroupLayout.PREFERRED_SIZE, 493, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(0, 74, Short.MAX_VALUE))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(lblAutor, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(btnPesquisar)
+ .addGap(142, 142, 142))))
.addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(299, 299, 299)
+ .addGap(296, 296, 296)
.addComponent(lblResultadosPesquisa)))
- .addContainerGap(150, Short.MAX_VALUE))
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(317, 317, 317)
- .addComponent(lblProdutos))
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(40, 40, 40)
- .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 653, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGap(0, 0, Short.MAX_VALUE))
+ .addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
- .addGap(28, 28, 28)
- .addComponent(lblProdutos)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addGap(41, 41, 41)
+ .addComponent(lblNome, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(titulo, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(lblNome)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(txtQuantidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(txtTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(lblAutor, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnPesquisar))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(txtAutor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lblResultadosPesquisa)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(Tabela, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btnComprar)
.addComponent(btnSobre))
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap())
);
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 789, Short.MAX_VALUE)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(0, 0, Short.MAX_VALUE)
- .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(0, 0, Short.MAX_VALUE)))
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 463, Short.MAX_VALUE)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(0, 0, Short.MAX_VALUE)
- .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(0, 0, Short.MAX_VALUE)))
- );
+ getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(560, 310, 760, 510));
+
+ btnSair.setFont(new java.awt.Font("Old London", 0, 48)); // NOI18N
+ btnSair.setText("Sair");
+ btnSair.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ btnSairActionPerformed(evt);
+ }
+ });
+ getContentPane().add(btnSair, new org.netbeans.lib.awtextra.AbsoluteConstraints(1720, 20, 130, 60));
+
+ jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/BuscarItem.png"))); // NOI18N
+ getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
}// //GEN-END:initComponents
private void btnPesquisarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPesquisarActionPerformed
// TODO add your handling code here:
+ if (estoque == null || estoque.isEmpty()) {
+ JOptionPane.showMessageDialog(this, "O estoque está vazio ou não foi carregado.", "Erro", JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+
+ String tituloPesquisado = txtTitulo.getText().toLowerCase().trim();
+ String autorPesquisado = txtAutor.getText().toLowerCase().trim();
+ String tituloPesquisadoPuro = txtTitulo.getText();
+ String autorPesquisadoPuro = txtAutor.getText();
+ if (tituloPesquisado.isEmpty()&& autorPesquisado.isEmpty()) {
+ JOptionPane.showMessageDialog(this, "Por favor, insira um título ou autor para pesquisar.", "Aviso", JOptionPane.WARNING_MESSAGE);
+ carregarTabelaProdutos();
+ return;
+ }
+
+
+ DefaultTableModel modeloTabelaProdutos = new DefaultTableModel(new Object[] {"Titulo", "Autor", "Gênero", "Valor", "Quant.Estoque"}, 0);
+
+ boolean produtoEncontrado = false;
+
+ boolean tituloVazio = tituloPesquisado.isBlank();
+ boolean autorVazio = autorPesquisado.isBlank();
+ for (Produto produto : estoque) {
+ if (produto != null && produto.getTitulo() != null && produto.getAutor() != null) {
+ boolean matchesTitle = tituloPesquisado.isBlank() || produto.getTitulo().toLowerCase().contains(tituloPesquisado);
+ boolean matchesAuthor = autorPesquisado.isBlank() || produto.getAutor().toLowerCase().contains(autorPesquisado);
+
+ if (matchesTitle && matchesAuthor) {
+ Object novalinha[] = new Object[]{
+ produto.getTitulo(),
+ produto.getAutor(),
+ produto.getGenero(),
+ produto.getPreço(),
+ produto.getQuantidadeEstoque()
+ };
+ modeloTabelaProdutos.addRow(novalinha);
+ produtoEncontrado = true;
+ }
+ }
+ }
+if (produtoEncontrado) {
+ tabela_produtos.setModel(modeloTabelaProdutos);
+ // Ajusta a largura das colunas
+ tabela_produtos.getColumnModel().getColumn(0).setPreferredWidth(100);
+ tabela_produtos.getColumnModel().getColumn(1).setPreferredWidth(50);
+ tabela_produtos.getColumnModel().getColumn(2).setPreferredWidth(14);
+ tabela_produtos.getColumnModel().getColumn(3).setPreferredWidth(8);
+ tabela_produtos.getColumnModel().getColumn(4).setPreferredWidth(3);
+}else{
+ if(autorPesquisado.isEmpty()){
+ JOptionPane.showMessageDialog(this, "Nenhum produto encontrado com o título: " + tituloPesquisadoPuro, "Resultado da pesquisa", JOptionPane.INFORMATION_MESSAGE);
+ carregarTabelaProdutos(); // Load all products if no matches found
+ }
+ if(tituloPesquisado.isEmpty()){
+ JOptionPane.showMessageDialog(this, "Nenhum produto encontrado com o autor: " + autorPesquisadoPuro, "Resultado da pesquisa", JOptionPane.INFORMATION_MESSAGE);
+ carregarTabelaProdutos();
+ }
+ if((!tituloPesquisado.isEmpty())&&(!autorPesquisado.isEmpty())){
+ JOptionPane.showMessageDialog(this, "Nenhum produto encontrado com o título: " + tituloPesquisadoPuro +" e autor: "+autorPesquisadoPuro, "Resultado da pesquisa", JOptionPane.INFORMATION_MESSAGE);
+ carregarTabelaProdutos();
+ }
+
+}
+
+
}//GEN-LAST:event_btnPesquisarActionPerformed
private void btnSobreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSobreActionPerformed
// TODO add your handling code here:
+ int row = tabela_produtos.getSelectedRow();
+ int column = tabela_produtos.getSelectedColumn();
+ Object produtoPesquisado = tabela_produtos.getValueAt(row,0);
+ String inputBusca = String.valueOf(produtoPesquisado);
+ String selected="";
+ for(Produto itemEstoque : estoque){
+ if(itemEstoque.getTitulo().equals(inputBusca)){
+ Produto item = itemEstoque;
+ selected = item.getTitulo();
+ auxProduto.set(0,item);
+ }
+ }
+ new infoProduto().setVisible(true);
+
}//GEN-LAST:event_btnSobreActionPerformed
private void btnComprarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnComprarActionPerformed
// TODO add your handling code here:
+ //int i = tabela_produtos.getSelectedRow();
+ if(!logado){
+ JOptionPane.showMessageDialog(null, "Entre com uma conta para poder adicionar ao carrinho!", "Erro ao adicionar para carrinho", JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+
+ int row = tabela_produtos.getSelectedRow();
+ if(row == -1) {
+ JOptionPane.showMessageDialog(null, "Por favor, selecione um produto na tabela.", "Erro ao adicionar para carrinho", JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+
+ Object produtoPesquisado = tabela_produtos.getValueAt(row, 0);
+ String inputBusca = String.valueOf(produtoPesquisado);
+ txtTitulo.setText(inputBusca);
+ System.out.println("Item do inputBusca a ser aparecido na caixa de texto: " + inputBusca);
+
+ String selected = "";
+ for(Produto itemEstoque : estoque){
+ if(itemEstoque.getTitulo().equals(inputBusca)){
+ selected = itemEstoque.getTitulo();
+ txtTitulo.setText(itemEstoque.getTitulo());
+ System.out.println(itemEstoque.getTitulo());
+ break;
+ }
+ }
+
+ System.out.println("Item selecionado para compra foi: " + selected);
+ for(Produto itemBusca : estoque){
+ if(itemBusca.getTitulo().equals(selected)){
+ int quantidadeDesejada = Integer.parseInt(txtQuantidade.getText());
+
+ if(quantidadeDesejada <= itemBusca.getQuantidadeEstoque()){
+ itemBusca.setQuantidadeComprada(quantidadeDesejada);
+ listaProdutos.add(itemBusca);
+ itemBusca.setQuantidadeEstoque(itemBusca.getQuantidadeEstoque() - quantidadeDesejada);
+ JOptionPane.showMessageDialog(null, "Item adicionado ao carrinho com sucesso!", "Notificação Adicionar item ao carrinho", JOptionPane.PLAIN_MESSAGE);
+ } else if(itemBusca.getQuantidadeEstoque() == 0){
+ JOptionPane.showMessageDialog(null, "Não há mais estoque para este item", "Erro ao adicionar item ao carrinho", JOptionPane.ERROR_MESSAGE);
+ } else {
+ JOptionPane.showMessageDialog(null, "Quantidade inserida acima da disponível!", "Erro ao adicionar item ao carrinho", JOptionPane.ERROR_MESSAGE);
+ }
+ break;
+ }
+ }
+
+ carregarTabelaProdutos();
+
}//GEN-LAST:event_btnComprarActionPerformed
- /**
- * @param args the command line arguments
- */
+ private void TabelaFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_TabelaFocusGained
+
+ }//GEN-LAST:event_TabelaFocusGained
+
+ private void txtQuantidadeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtQuantidadeActionPerformed
+ // TODO add your handling code here:
+ }//GEN-LAST:event_txtQuantidadeActionPerformed
+
+ private void tabela_produtosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tabela_produtosMouseClicked
+ // TODO add your handling code here:
+ int i = tabela_produtos.getSelectedRow();
+ int row = tabela_produtos.getSelectedRow();
+ int column = tabela_produtos.getSelectedColumn();
+ Object produtoPesquisado = tabela_produtos.getValueAt(row,0);
+ System.out.println("Value selected at: "+produtoPesquisado);
+ String inputBusca = String.valueOf(produtoPesquisado);
+ System.out.println("Item do inputBusca a ser aparecido na caixa de texto"+inputBusca);
+ btnSobre.setEnabled(true);
+
+ }//GEN-LAST:event_tabela_produtosMouseClicked
+
+ private void btnSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSairActionPerformed
+ // TODO add your handling code here:
+ this.setVisible(false);
+ }//GEN-LAST:event_btnSairActionPerformed
+
+ private void jPanel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanel1MouseClicked
+ // TODO add your handling code here:
+ btnSobre.setEnabled(false);
+ tabela_produtos.clearSelection();
+ }//GEN-LAST:event_jPanel1MouseClicked
+
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//
@@ -218,21 +475,27 @@ public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new verProdutos().setVisible(true);
+
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JTextArea Pesquisa;
+ private javax.swing.JScrollPane Tabela;
private javax.swing.JButton btnComprar;
private javax.swing.JButton btnPesquisar;
+ private javax.swing.JButton btnSair;
private javax.swing.JButton btnSobre;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
private javax.swing.JPanel jPanel1;
- private javax.swing.JScrollPane jScrollPane1;
- private javax.swing.JScrollPane jScrollPane2;
+ private javax.swing.JLabel lblAutor;
private javax.swing.JLabel lblNome;
- private javax.swing.JLabel lblProdutos;
private javax.swing.JLabel lblResultadosPesquisa;
private javax.swing.JTable tabela_produtos;
+ private javax.swing.JLabel titulo;
+ private javax.swing.JTextField txtAutor;
+ private javax.swing.JTextField txtQuantidade;
+ private javax.swing.JTextField txtTitulo;
// End of variables declaration//GEN-END:variables
}