package Telas;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
public class TelaPrincipal extends javax.swing.JFrame {
public TelaPrincipal(String auth) {
initComponents(auth);
}
private void initComponents(String auth) {
jDesktopPane1 = new javax.swing.JDesktopPane();
jLabel1 = new javax.swing.JLabel();
jMenuBar = new javax.swing.JMenuBar();
jMenuServicos = new javax.swing.JMenu();
jMenuItemServicos = new javax.swing.JMenuItem();
jMenuItemProdutos = new javax.swing.JMenuItem();
jMenuUsuarios = new javax.swing.JMenu();
jMenuItemCadastro = new javax.swing.JMenuItem();
jMenuItemEditar = new javax.swing.JMenuItem();
jMenuItemExcluir = new javax.swing.JMenuItem();
jMenuAgenda = new javax.swing.JMenu();
jMenuItemAgenda = new javax.swing.JMenuItem();
jMenuConfig = new javax.swing.JMenu();
jMenuRelatorio = new javax.swing.JMenu();
jMenuItemRelatorioUsuario = new javax.swing.JMenuItem();
jMenuItemRelatorioServico = new javax.swing.JMenuItem();
jMenuItemRelatorioAgenda = new javax.swing.JMenuItem();
jMenuSobre = new javax.swing.JMenu();
jMenuItemSobre = new javax.swing.JMenuItem();
jMenuSair = new javax.swing.JMenu();
jMenuItemLogout = new javax.swing.JMenuItem();
jMenuItemSair = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("BARBEATOR");
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setLocation(new java.awt.Point(300, 150));
jDesktopPane1.setBackground(new java.awt.Color(0, 102, 153));
jDesktopPane1.setAutoscrolls(true);
jDesktopPane1.setMaximumSize(new java.awt.Dimension(2048, 2048));
jDesktopPane1.setPreferredSize(new java.awt.Dimension(750, 500));
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/Background/BackgroundPrincipal.png"))); // NOI18N
jLabel1.setAlignmentY(0.0F);
jLabel1.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);
jDesktopPane1.setLayer(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);
javax.swing.GroupLayout jDesktopPane1Layout = new javax.swing.GroupLayout(jDesktopPane1);
jDesktopPane1.setLayout(jDesktopPane1Layout);
jDesktopPane1Layout.setHorizontalGroup(
jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jDesktopPane1Layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 702, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
jDesktopPane1Layout.setVerticalGroup(
jDesktopPane1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 452, Short.MAX_VALUE)
);
jMenuBar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, java.awt.Color.lightGray, java.awt.Color.darkGray, null, null));
jMenuBar.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 12)); // NOI18N
jMenuServicos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/Servicos-32.png"))); // NOI18N
jMenuServicos.setText("Servicos");
jMenuServicos.setFocusable(false);
jMenuServicos.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 12)); // NOI18N
jMenuItemServicos.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 11)); // NOI18N
jMenuItemServicos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/Contabilidade-32.png"))); // NOI18N
jMenuItemServicos.setText("Servicos");
jMenuItemServicos.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemServicosActionPerformed(evt);
}
});
jMenuServicos.add(jMenuItemServicos);
jMenuItemProdutos.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 11)); // NOI18N
jMenuItemProdutos.setText("Produtos");
jMenuItemProdutos.setEnabled(false);
jMenuItemProdutos.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemProdutosActionPerformed(evt);
}
});
jMenuServicos.add(jMenuItemProdutos);
jMenuBar.add(jMenuServicos);
jMenuUsuarios.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/UsuarioDeGeneroNeutro32.png"))); // NOI18N
jMenuUsuarios.setText("Usuarios");
jMenuUsuarios.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 12)); // NOI18N
jMenuItemCadastro.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 11)); // NOI18N
jMenuItemCadastro.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/AddUsuarioMasculino.png"))); // NOI18N
jMenuItemCadastro.setText("Cadastrar");
jMenuItemCadastro.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemCadastroActionPerformed(evt);
}
});
jMenuUsuarios.add(jMenuItemCadastro);
jMenuItemEditar.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 11)); // NOI18N
jMenuItemEditar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/EditarUsuarioMasculino32.png"))); // NOI18N
jMenuItemEditar.setText("Editar");
jMenuItemEditar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemEditarActionPerformed(evt);
}
});
jMenuUsuarios.add(jMenuItemEditar);
jMenuItemExcluir.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 11)); // NOI18N
jMenuItemExcluir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/RemoverUsuarioMasculino32.png"))); // NOI18N
jMenuItemExcluir.setText("Excluir");
jMenuItemExcluir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemExcluirActionPerformed(evt);
}
});
jMenuUsuarios.add(jMenuItemExcluir);
jMenuBar.add(jMenuUsuarios);
jMenuAgenda.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/LivroDeEnderecos32.png"))); // NOI18N
jMenuAgenda.setText("Agenda");
jMenuAgenda.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 12)); // NOI18N
jMenuItemAgenda.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 11)); // NOI18N
jMenuItemAgenda.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/Calendario32.png"))); // NOI18N
jMenuItemAgenda.setText("Agenda");
jMenuItemAgenda.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemAgendaActionPerformed(evt);
}
});
jMenuAgenda.add(jMenuItemAgenda);
jMenuBar.add(jMenuAgenda);
jMenuConfig.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/Configuracoes32.png"))); // NOI18N
jMenuConfig.setText("Config");
jMenuConfig.setEnabled(false);
jMenuConfig.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 12)); // NOI18N
jMenuBar.add(jMenuConfig);
jMenuRelatorio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/Arquivo-32.png"))); // NOI18N
jMenuRelatorio.setText("RELATORIOS");
jMenuRelatorio.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 11)); // NOI18N
jMenuItemRelatorioUsuario.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 11)); // NOI18N
jMenuItemRelatorioUsuario.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/LivroDeEnderecos32.png"))); // NOI18N
jMenuItemRelatorioUsuario.setText("Relatorio de usuarios");
jMenuItemRelatorioUsuario.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemRelatorioUsuarioActionPerformed(evt);
}
});
jMenuRelatorio.add(jMenuItemRelatorioUsuario);
jMenuItemRelatorioServico.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 11)); // NOI18N
jMenuItemRelatorioServico.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/Contabilidade-32.png"))); // NOI18N
jMenuItemRelatorioServico.setText("Relatorio de servicos");
jMenuItemRelatorioServico.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemRelatorioServicoActionPerformed(evt);
}
});
jMenuRelatorio.add(jMenuItemRelatorioServico);
jMenuItemRelatorioAgenda.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 11)); // NOI18N
jMenuItemRelatorioAgenda.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/AFazer-32.png"))); // NOI18N
jMenuItemRelatorioAgenda.setText("Relatorio de agendamentos");
jMenuItemRelatorioAgenda.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemRelatorioAgendaActionPerformed(evt);
}
});
jMenuRelatorio.add(jMenuItemRelatorioAgenda);
jMenuBar.add(jMenuRelatorio);
jMenuSobre.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/Sobre-32.png"))); // NOI18N
jMenuSobre.setText("Sobre");
jMenuSobre.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 12)); // NOI18N
jMenuSobre.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuSobreActionPerformed(evt);
}
});
jMenuItemSobre.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 11)); // NOI18N
jMenuItemSobre.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/Sobre-32.png"))); // NOI18N
jMenuItemSobre.setText("Sobre");
jMenuItemSobre.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemSobreActionPerformed(evt);
}
});
jMenuSobre.add(jMenuItemSobre);
jMenuBar.add(jMenuSobre);
jMenuSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/Sair-32.png"))); // NOI18N
jMenuSair.setText("Sair");
jMenuSair.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 12)); // NOI18N
jMenuSair.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuSairActionPerformed(evt);
}
});
jMenuItemLogout.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 11)); // NOI18N
jMenuItemLogout.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/SinalDeSaida-32.png"))); // NOI18N
jMenuItemLogout.setText("Log out");
jMenuItemLogout.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemLogoutActionPerformed(evt);
}
});
jMenuSair.add(jMenuItemLogout);
jMenuItemSair.setFont(new java.awt.Font("American Brewery Rough Demo", 0, 11)); // NOI18N
jMenuItemSair.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagens/inconesMenu/Sair-32.png"))); // NOI18N
jMenuItemSair.setText("Sair");
jMenuItemSair.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItemSairActionPerformed(evt);
}
});
jMenuSair.add(jMenuItemSair);
jMenuBar.add(jMenuSair);
setJMenuBar(jMenuBar);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 702, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 452, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
pack();
}
private void jMenuItemProdutosActionPerformed(java.awt.event.ActionEvent evt) {
}
private void jMenuItemCadastroActionPerformed(java.awt.event.ActionEvent evt) {
JFrame telaCadUsu = new TelaCadastroUsuario();
telaCadUsu.setVisible(true);
}
private void jMenuItemEditarActionPerformed(java.awt.event.ActionEvent evt) {
JFrame telaEditUser = new TelaEditarUsuario();
telaEditUser.setVisible(true);
}
private void jMenuItemExcluirActionPerformed(java.awt.event.ActionEvent evt) {
JFrame telaExcluiUser = new TelaExcluirUsuario();
telaExcluiUser.setVisible(true);
}
private void jMenuItemAgendaActionPerformed(java.awt.event.ActionEvent evt) {
TelaAgenda telaAgendamento = new TelaAgenda();
telaAgendamento.setVisible(true);
}
private void jMenuItemSobreActionPerformed(java.awt.event.ActionEvent evt) {
TelaSobre sobre = new TelaSobre();
jDesktopPane1.add(sobre);
sobre.setVisible(true);
}
private void jMenuSobreActionPerformed(java.awt.event.ActionEvent evt) {
}
private void jMenuItemLogoutActionPerformed(java.awt.event.ActionEvent evt) {
JFrame telaLogin = new TelaLogin();
telaLogin.setVisible(true);
dispose();
}
private void jMenuItemSairActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
private void jMenuSairActionPerformed(java.awt.event.ActionEvent evt) {
}
private void jMenuItemServicosActionPerformed(java.awt.event.ActionEvent evt) {
TelaServicos telaServicos = new TelaServicos();
telaServicos.setVisible(true);
}
private void jMenuItemRelatorioUsuarioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemRelatorioUsuarioActionPerformed
/*
BufferedWriter bw = null;
try{
BufferedReader ler = new BufferedReader(new FileReader("C:/Barbeator/login.txt"));
}catch(IOException erro){
}
*/
File arquivo = new File("C:/Users/jrabe/Desktop/Barbeator/database.txt");
File relatorio = new File("C:/Users/jrabe/Desktop/Barbeator/Relatorio de usuarios.txt");
try {
FileReader leitor = new FileReader(arquivo);
BufferedReader leitorarquivo = new BufferedReader(leitor);
FileWriter fileWriter = new FileWriter(relatorio);
BufferedWriter escritor = new BufferedWriter(fileWriter);
String linha = leitorarquivo.readLine();
while(linha != null){
escritor.write(linha);
//System.out.println(escritor);
escritor.newLine();
linha = leitorarquivo.readLine();
}
escritor.close();
fileWriter.close();
JOptionPane.showMessageDialog(null, "Relatório gerado!!", "Sucesso!", JOptionPane.WARNING_MESSAGE);
}catch(IOException erro) {
JOptionPane.showMessageDialog(null, "Relatório não pôde ser gerado!", "Falha!", JOptionPane.WARNING_MESSAGE);
}
}
private void jMenuItemRelatorioServicoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemRelatorioServicoActionPerformed
File arquivo = new File("C:/Users/jrabe/Desktop/Barbeator/servicos.txt");
File relatorio = new File("C:/Users/jrabe/Desktop/Barbeator/Relatorio de servicos.txt");
try {
FileReader leitor = new FileReader(arquivo);
BufferedReader leitorarquivo = new BufferedReader(leitor);
FileWriter fileWriter = new FileWriter(relatorio);
BufferedWriter escritor = new BufferedWriter(fileWriter);
String linha = leitorarquivo.readLine();
while(linha != null){
escritor.write(linha);
//System.out.println(escritor);
escritor.newLine();
linha = leitorarquivo.readLine();
}
escritor.close();
fileWriter.close();
JOptionPane.showMessageDialog(null, "Relatório gerado!!", "Sucesso!", JOptionPane.WARNING_MESSAGE);
}catch(IOException erro) {
JOptionPane.showMessageDialog(null, "Relatório não pôde ser gerado!", "Falha!", JOptionPane.WARNING_MESSAGE);
}
}//GEN-LAST:event_jMenuItemRelatorioServicoActionPerformed
private void jMenuItemRelatorioAgendaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemRelatorioAgendaActionPerformed
File arquivo = new File("C:/Users/jrabe/Desktop/Barbeator/agendamentos.txt");
File relatorio = new File("C:/Users/jrabe/Desktop/Barbeator/Relatorio de agendamentos.txt");
try {
FileReader leitor = new FileReader(arquivo);
BufferedReader leitorarquivo = new BufferedReader(leitor);
FileWriter fileWriter = new FileWriter(relatorio);
BufferedWriter escritor = new BufferedWriter(fileWriter);
String linha = leitorarquivo.readLine();
while(linha != null){
escritor.write(linha);
//System.out.println(escritor);
escritor.newLine();
linha = leitorarquivo.readLine();
}
escritor.close();
fileWriter.close();
JOptionPane.showMessageDialog(null, "Relatório gerado!!", "Sucesso!", JOptionPane.WARNING_MESSAGE);
}catch(IOException erro) {
JOptionPane.showMessageDialog(null, "Relatório não pôde ser gerado!", "Falha!", JOptionPane.WARNING_MESSAGE);
}
}//GEN-LAST:event_jMenuItemRelatorioAgendaActionPerformed
public static void main(String[] args) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Windows".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(TelaPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
String auth;
public void run() {
new TelaPrincipal(auth).setVisible(true);
}
});
}
private javax.swing.JDesktopPane jDesktopPane1;
private javax.swing.JLabel jLabel1;
private javax.swing.JMenu jMenuAgenda;
private javax.swing.JMenuBar jMenuBar;
private javax.swing.JMenu jMenuConfig;
private javax.swing.JMenuItem jMenuItemAgenda;
private javax.swing.JMenuItem jMenuItemCadastro;
private javax.swing.JMenuItem jMenuItemEditar;
private javax.swing.JMenuItem jMenuItemExcluir;
private javax.swing.JMenuItem jMenuItemLogout;
private javax.swing.JMenuItem jMenuItemProdutos;
private javax.swing.JMenuItem jMenuItemRelatorioAgenda;
private javax.swing.JMenuItem jMenuItemRelatorioServico;
private javax.swing.JMenuItem jMenuItemRelatorioUsuario;
private javax.swing.JMenuItem jMenuItemSair;
private javax.swing.JMenuItem jMenuItemServicos;
private javax.swing.JMenuItem jMenuItemSobre;
private javax.swing.JMenu jMenuRelatorio;
private javax.swing.JMenu jMenuSair;
private javax.swing.JMenu jMenuServicos;
private javax.swing.JMenu jMenuSobre;
private javax.swing.JMenu jMenuUsuarios;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.